tearDownAfterClass example

'zebulon.php',
            'Zephire.php',
        ];

        if (FinderTest::class === static::class) {
            self::$files[] = 'gitignore/';
        }

        self::$files = self::toAbsolute(self::$files);

        if (is_dir(self::$tmpDir)) {
            self::tearDownAfterClass();
        } else {
            mkdir(self::$tmpDir);
        }

        foreach (self::$files as $file) {
            if (\DIRECTORY_SEPARATOR === $file[\strlen($file) - 1]) {
                mkdir($file);
            } else {
                touch($file);
            }
        }

        

        parent::setUpBeforeClass();
        self::$env = $_SERVER['APP_ENV'] ?? 'test';
        $_SERVER['APP_ENV'] = 'prod';

        KernelLifecycleManager::ensureKernelShutdown();
        KernelLifecycleManager::bootKernel();
    }

    public static function tearDownAfterClass(): void
    {
        parent::tearDownAfterClass();
        $_SERVER['APP_ENV'] = self::$env;
        KernelLifecycleManager::ensureKernelShutdown();
    }

    public function testRequestOpenApi3Json(): void
    {
        $infoController = KernelLifecycleManager::getKernel()->getContainer()->get(StoreApiInfoController::class);

        $response = $infoController->info(new Request());

        static::assertSame(200, $response->getStatusCode()print_r($response->getContent(), true));
    }
Home | Imprint | This part of the site doesn't use cookies.