![]() 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/App/Test/Unit/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Framework\App\Test\Unit; use Magento\Framework\App\Bootstrap; use Magento\Framework\Filesystem\Io\File; use PHPUnit\Framework\TestCase; /** * @covers \Magento\Framework\App\ObjectManagerFactory */ class ObjectManagerFactoryTest extends TestCase { /** @var callable[] */ protected static $originalAutoloadFunctions; /** @var string */ protected static $originalIncludePath; public static function setUpBeforeClass(): void { self::$originalAutoloadFunctions = spl_autoload_functions(); self::$originalIncludePath = get_include_path(); } /** * Avoid impact of initialized \Magento\Framework\Code\Generator\Autoloader on other tests */ public static function tearDownAfterClass(): void { foreach (spl_autoload_functions() as $autoloadFunction) { spl_autoload_unregister($autoloadFunction); } foreach (self::$originalAutoloadFunctions as $autoloadFunction) { spl_autoload_register($autoloadFunction); } set_include_path(self::$originalIncludePath); File::rmdirRecursive(__DIR__ . '/_files/var/'); } public function testCreateObjectManagerFactoryCouldBeOverridden() { $this->expectException('BadMethodCallException'); $this->expectExceptionMessage('Magento\Framework\App\Test\Unit\ObjectManager\FactoryStub::__construct'); $rootPath = __DIR__ . '/_files/'; $factory = Bootstrap::createObjectManagerFactory($rootPath, []); $factory->create([], false); } }