![]() 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/codeception/codeception/src/Codeception/Util/ |
<?php declare(strict_types=1); namespace Codeception\Util; use RuntimeException; /** * Really basic class to store data in global array and use it in Cests/Tests. * * ```php * <?php * Fixtures::add('user1', ['name' => 'davert']); * Fixtures::get('user1'); * Fixtures::exists('user1'); * ``` */ class Fixtures { protected static array $fixtures = []; public static function add(string $name, $data): void { self::$fixtures[$name] = $data; } public static function get(string $name) { if (!self::exists($name)) { throw new RuntimeException("{$name} not found in fixtures"); } return self::$fixtures[$name]; } public static function cleanup(string $name = ''): void { if (self::exists($name)) { unset(self::$fixtures[$name]); return; } self::$fixtures = []; } public static function exists(string $name): bool { return isset(self::$fixtures[$name]); } }