![]() 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/framework/View/Test/Unit/Design/Fallback/Rule/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Framework\View\Test\Unit\Design\Fallback\Rule; use Magento\Framework\Component\ComponentRegistrar; use Magento\Framework\Component\ComponentRegistrarInterface; use Magento\Framework\View\Design\Fallback\Rule\Module; use Magento\Framework\View\Design\Fallback\Rule\RuleInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ModuleTest extends TestCase { /** * @var RuleInterface|MockObject */ private $rule; /** * @var ComponentRegistrarInterface|MockObject */ private $componentRegistrar; /** * @var Module */ private $model; protected function setUp(): void { $this->rule = $this->getMockForAbstractClass(RuleInterface::class); $this->componentRegistrar = $this->getMockForAbstractClass( ComponentRegistrarInterface::class ); $this->model = new Module($this->rule, $this->componentRegistrar); } public function testGetPatternDirsException() { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('Required parameter "module_name" is not specified'); $this->model->getPatternDirs([]); } public function testGetPatternDirs() { $expectedResult = ['path1', 'path2']; $module = 'Some_Module'; $modulePath = '/module/path'; $this->componentRegistrar->expects($this->once()) ->method('getPath') ->with(ComponentRegistrar::MODULE, $module) ->willReturn($modulePath); $this->rule->expects($this->once()) ->method('getPatternDirs') ->with(['module_name' => $module, 'module_dir' => $modulePath]) ->willReturn($expectedResult); $this->assertEquals($expectedResult, $this->model->getPatternDirs(['module_name' => $module])); } }