-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix symfony proxy cache warmup * register framework related services in framework * test proxy cache generation --------- Co-authored-by: jlabedo <jean@needelp.com>
- Loading branch information
Showing
7 changed files
with
99 additions
and
17 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
Monorepo/CrossModuleTests/Tests/ProxyCacheGenerationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
use Ecotone\Messaging\Config\ConfiguredMessagingSystem; | ||
use Illuminate\Foundation\Http\Kernel as LaravelKernel; | ||
use Monorepo\Benchmark\FullAppBenchmarkCase; | ||
use Monorepo\ExampleApp\ExampleAppCaseTrait; | ||
use Psr\Container\ContainerInterface; | ||
use Symfony\Component\HttpKernel\Kernel as SymfonyKernel; | ||
|
||
class ProxyCacheGenerationTest extends FullAppBenchmarkCase | ||
{ | ||
use ExampleAppCaseTrait; | ||
|
||
/** | ||
* @runInSeparateProcess | ||
* @preserveGlobalState disabled | ||
*/ | ||
public function test_symfony_prod() | ||
{ | ||
self::clearSymfonyCache(); | ||
$this->bench_symfony_prod(); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
* @preserveGlobalState disabled | ||
*/ | ||
public function test_laravel_prod(): void | ||
{ | ||
self::clearLaravelCache(); | ||
$this->bench_laravel_prod(); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
* @preserveGlobalState disabled | ||
*/ | ||
public function test_lite_application_prod() | ||
{ | ||
self::clearLiteApplicationCache(); | ||
$this->bench_lite_application_prod(); | ||
} | ||
|
||
/** | ||
* @runInSeparateProcess | ||
* @preserveGlobalState disabled | ||
*/ | ||
public function test_lite_prod() | ||
{ | ||
self::clearLiteCache(); | ||
$this->bench_lite_prod(); | ||
} | ||
|
||
public function executeForSymfony(ContainerInterface $container, SymfonyKernel $kernel): void | ||
{ | ||
$this->execute($container->get(ConfiguredMessagingSystem::class)); | ||
} | ||
|
||
public function executeForLaravel(ContainerInterface $container, LaravelKernel $kernel): void | ||
{ | ||
$this->execute($container->get(ConfiguredMessagingSystem::class)); | ||
} | ||
|
||
public function executeForLiteApplication(ContainerInterface $container): void | ||
{ | ||
$this->execute($container->get(ConfiguredMessagingSystem::class)); | ||
} | ||
|
||
public function executeForLite(ConfiguredMessagingSystem $messagingSystem): void | ||
{ | ||
$this->execute($messagingSystem); | ||
} | ||
|
||
private function execute(ConfiguredMessagingSystem $messagingSystem) | ||
{ | ||
$commandBusProxy = $messagingSystem->getCommandBus(); | ||
$reflection = new ReflectionClass($commandBusProxy); | ||
$filename = $reflection->getFileName(); | ||
self::assertFalse(self::isEvalCode($filename), 'Proxy class should not be generated as eval code'); | ||
} | ||
|
||
private static function isEvalCode(string $fileName): bool | ||
{ | ||
return strpos($fileName, "eval()'d code") !== false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters