![]() 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-deploy/Test/Unit/Service/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Deploy\Test\Unit\Service; use Magento\Deploy\Service\MinifyTemplates; use Magento\Framework\App\Utility\Files; use Magento\Framework\View\Template\Html\MinifierInterface; use PHPUnit\Framework\MockObject\MockObject as Mock; use PHPUnit\Framework\TestCase; /** * Minify Templates service class unit tests */ class MinifyTemplatesTest extends TestCase { /** * @var MinifyTemplates */ private $service; /** * @var Files|Mock */ private $filesUtils; /** * @var MinifierInterface|Mock */ private $htmlMinifier; /** * @inheritdoc */ protected function setUp(): void { $this->filesUtils = $this->createPartialMock(Files::class, ['getPhtmlFiles']); $this->htmlMinifier = $this->getMockForAbstractClass( MinifierInterface::class, ['minify'], '', false ); $this->service = new MinifyTemplates( $this->filesUtils, $this->htmlMinifier ); } /** * @see MinifyTemplates::minifyTemplates() */ public function testMinifyTemplates() { $templateMock = "template.phtml"; $templatesMock = [$templateMock]; $this->filesUtils->expects($this->once()) ->method('getPhtmlFiles') ->with(false, false) ->willReturn($templatesMock); $this->htmlMinifier->expects($this->once())->method('minify')->with($templateMock); $this->assertEquals(1, $this->service->minifyTemplates()); } }