![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-email/Test/Unit/Model/Template/Css/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Email\Test\Unit\Model\Template\Css; use Magento\Email\Model\Template\Css\Processor; use Magento\Framework\View\Asset\File\FallbackContext; use Magento\Framework\View\Asset\Repository; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ProcessorTest extends TestCase { /** * @var Processor */ protected $processor; /** * @var Repository|MockObject */ protected $assetRepository; /** * @var FallbackContext|MockObject */ protected $fallbackContext; protected function setUp(): void { $this->assetRepository = $this->getMockBuilder(Repository::class) ->disableOriginalConstructor() ->getMock(); $this->fallbackContext = $this->getMockBuilder(FallbackContext::class) ->disableOriginalConstructor() ->getMock(); $this->processor = new Processor($this->assetRepository); } public function testProcess() { $url = 'http://magento.local/static/'; $locale = 'en_US'; $css = '@import url("{{base_url_path}}frontend/_view/{{locale}}/css/email.css");'; $expectedCss = '@import url("' . $url . 'frontend/_view/' . $locale . '/css/email.css");'; $this->assetRepository->expects($this->exactly(2)) ->method('getStaticViewFileContext') ->willReturn($this->fallbackContext); $this->fallbackContext->expects($this->once()) ->method('getBaseUrl') ->willReturn($url); $this->fallbackContext->expects($this->once()) ->method('getLocale') ->willReturn($locale); $this->assertEquals($expectedCss, $this->processor->process($css)); } }