![]() 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/dev/tests/integration/testsuite/Magento/Framework/Filesystem/ |
<?php /** * Integration test for \Magento\Framework\Filesystem\FileResolver * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Filesystem; use Magento\TestFramework\Helper\Bootstrap; class FileResolverTest extends \PHPUnit\Framework\TestCase { /** * Path to add to include path */ const FIRST_PATH = '/path/to/code/1/'; /** * Path to add to include path */ const SECOND_PATH = '/path/to/code/2/'; /** * @var \Magento\Framework\Filesystem\FileResolver */ protected $model; /** * @var string original include-path variable */ protected $originalPath; protected function setUp(): void { $this->model = Bootstrap::getObjectManager()->create(\Magento\Framework\Filesystem\FileResolver::class); $this->originalPath = get_include_path(); set_include_path('/pre/existing/paths/'); } protected function tearDown(): void { set_include_path($this->originalPath); } public function testAddIncludePathPrepend() { $this->model->addIncludePath(self::FIRST_PATH); $this->model->addIncludePath(self::SECOND_PATH); $postIncludePath = get_include_path(); $this->assertStringStartsWith( self::SECOND_PATH, $postIncludePath ); } public function testAddIncludePathAppend() { $this->model->addIncludePath(self::FIRST_PATH, false); $this->model->addIncludePath(self::SECOND_PATH, false); $postIncludePath = get_include_path(); $this->assertStringEndsWith( self::SECOND_PATH, $postIncludePath ); } public function testGetFile() { $includePath = realpath(__DIR__ . '/_files/'); $className = '\ClassToFind'; $this->model->addIncludePath($includePath); $this->assertFileExists($this->model->getFile($className)); } }