@@ -23,71 +23,71 @@ discard block |
||
| 23 | 23 | use Symfony\Component\Cache\Adapter\ArrayAdapter; |
| 24 | 24 | |
| 25 | 25 | class WebTestCase extends BaseWebTestCase { |
| 26 | - protected ?AbstractDatabaseTool $databaseTool; |
|
| 27 | - private static ?KernelBrowser $client = null; |
|
| 26 | + protected ?AbstractDatabaseTool $databaseTool; |
|
| 27 | + private static ?KernelBrowser $client = null; |
|
| 28 | 28 | |
| 29 | - public function setUp(): void { |
|
| 29 | + public function setUp(): void { |
|
| 30 | 30 | if (self::$client == null) { |
| 31 | - self::$client = parent::createClient(); |
|
| 31 | + self::$client = parent::createClient(); |
|
| 32 | 32 | } |
| 33 | 33 | $this->databaseTool = static::getContainer()->get(DatabaseToolCollection::class)->get(); |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Initializes database. |
|
| 38 | - */ |
|
| 39 | - protected function initDatabase() { |
|
| 36 | + /** |
|
| 37 | + * Initializes database. |
|
| 38 | + */ |
|
| 39 | + protected function initDatabase() { |
|
| 40 | 40 | $this->clearMetadataCache(); |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Clears metadata cache of the various cache drivers. |
|
| 45 | - */ |
|
| 46 | - private function clearMetadataCache() { |
|
| 43 | + /** |
|
| 44 | + * Clears metadata cache of the various cache drivers. |
|
| 45 | + */ |
|
| 46 | + private function clearMetadataCache() { |
|
| 47 | 47 | $entityManager = $this->getContainer()->get('doctrine.orm.entity_manager'); |
| 48 | 48 | |
| 49 | 49 | $cacheDriver = $entityManager->getConfiguration()->getMetadataCacheImpl(); |
| 50 | 50 | |
| 51 | 51 | if (!$cacheDriver instanceof ArrayAdapter) { |
| 52 | - $cacheDriver->deleteAll(); |
|
| 52 | + $cacheDriver->deleteAll(); |
|
| 53 | + } |
|
| 53 | 54 | } |
| 54 | - } |
|
| 55 | 55 | |
| 56 | - protected function tearDown(): void { |
|
| 56 | + protected function tearDown(): void { |
|
| 57 | 57 | unset($this->databaseTool); |
| 58 | 58 | $reflection = new \ReflectionObject($this); |
| 59 | 59 | foreach ($reflection->getProperties() as $prop) { |
| 60 | - if (!$prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) { |
|
| 60 | + if (!$prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) { |
|
| 61 | 61 | $prop->setAccessible(true); |
| 62 | 62 | if ($prop->name == 'databaseTool') { |
| 63 | - continue; |
|
| 63 | + continue; |
|
| 64 | 64 | } |
| 65 | 65 | $prop->setValue($this, null); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | parent::tearDown(); |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - protected function loadCustomFixtures(array $fixtures) { |
|
| 71 | + protected function loadCustomFixtures(array $fixtures) { |
|
| 72 | 72 | $env = $this->getContainer()->getParameter('test_env'); |
| 73 | - echo "\n\n>>>>>>>>>>>>> Load Custom Fixtures ENV: " . $env . "\n\n"; |
|
| 73 | + echo "\n\n>>>>>>>>>>>>> Load Custom Fixtures ENV: " . $env . "\n\n"; |
|
| 74 | 74 | $registry = new FixtureRegistry(); |
| 75 | 75 | $registry->setEnvironment($env); |
| 76 | 76 | |
| 77 | 77 | return $this->databaseTool->loadFixtures($registry->getFixtures($fixtures))->getReferenceRepository(); |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - public static function createClient(array $options = [], array $server = []) { |
|
| 80 | + public static function createClient(array $options = [], array $server = []) { |
|
| 81 | 81 | if (!array_key_exists('HTTP_Authorization', $server)) { |
| 82 | - $server['HTTP_Authorization'] = base64_encode('test_token:'); |
|
| 82 | + $server['HTTP_Authorization'] = base64_encode('test_token:'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if (null === $server['HTTP_Authorization']) { |
| 86 | - unset($server['HTTP_Authorization']); |
|
| 86 | + unset($server['HTTP_Authorization']); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if(!array_key_exists("HTTP_HOST", $server)) { |
| 90 | - $server['HTTP_HOST'] = 'localhost'; |
|
| 90 | + $server['HTTP_HOST'] = 'localhost'; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $newClient = clone self::$client; |
@@ -95,5 +95,5 @@ discard block |
||
| 95 | 95 | $newClient->getKernel()->shutdown(); |
| 96 | 96 | $newClient->getKernel()->boot(); |
| 97 | 97 | return $newClient; |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | protected function loadCustomFixtures(array $fixtures) { |
| 72 | 72 | $env = $this->getContainer()->getParameter('test_env'); |
| 73 | - echo "\n\n>>>>>>>>>>>>> Load Custom Fixtures ENV: " . $env . "\n\n"; |
|
| 73 | + echo "\n\n>>>>>>>>>>>>> Load Custom Fixtures ENV: ".$env."\n\n"; |
|
| 74 | 74 | $registry = new FixtureRegistry(); |
| 75 | 75 | $registry->setEnvironment($env); |
| 76 | 76 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | unset($server['HTTP_Authorization']); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if(!array_key_exists("HTTP_HOST", $server)) { |
|
| 89 | + if (!array_key_exists("HTTP_HOST", $server)) { |
|
| 90 | 90 | $server['HTTP_HOST'] = 'localhost'; |
| 91 | 91 | } |
| 92 | 92 | |