1515use function PHPUnit \Framework \assertThat ;
1616use function PHPUnit \Framework \equalTo ;
1717use function PHPUnit \Framework \greaterThanOrEqual ;
18- use function PHPUnit \Framework \lessThan ;
1918use function PHPUnit \Framework \lessThanOrEqual ;
2019use function PHPUnit \Framework \logicalAnd ;
2120
@@ -64,6 +63,10 @@ public function testPerformanceDidNotChangeForStableEndpoints() {
6463 $ not200Responses = array_filter ($ responseCodes , fn ($ value ) => 200 != $ value );
6564 assertThat ($ not200Responses , equalTo ([]));
6665
66+ if (static ::isPerformanceTestDebugOutput ()) {
67+ var_dump ($ queryExecutionTime );
68+ }
69+
6770 $ endpointsWithTooLongExecutionTime = array_filter ($ queryExecutionTime , fn ($ value ) => MAX_EXECUTION_TIME_SECONDS < $ value );
6871 assertThat ($ endpointsWithTooLongExecutionTime , equalTo ([]));
6972
@@ -82,10 +85,14 @@ public function testNumberOfQueriesDidNotChangeForContentNodeCollectionEndpoints
8285 if ('test ' !== $ this ->getEnvironment ()) {
8386 self ::markTestSkipped (__FUNCTION__ .' is only run in test environment, not in ' .$ this ->getEnvironment ());
8487 }
85- list ($ statusCode , $ queryCount ) = $ this ->measurePerformanceFor ($ collectionEndpoint );
88+ list ($ statusCode , $ queryCount, $ executionTimeSeconds ) = $ this ->measurePerformanceFor ($ collectionEndpoint );
8689
8790 assertThat ($ statusCode , equalTo (200 ));
8891
92+ if (static ::isPerformanceTestDebugOutput ()) {
93+ echo "{$ collectionEndpoint }: {$ executionTimeSeconds }\n" ;
94+ }
95+
8996 $ queryCountRanges = self ::getContentNodeEndpointQueryCountRanges ()[$ collectionEndpoint ];
9097 assertThat (
9198 $ queryCount ,
@@ -116,6 +123,10 @@ public function testNumberOfQueriesDidNotChangeForContentNodeItemEndpoints(strin
116123
117124 assertThat ($ statusCode , equalTo (200 ));
118125
126+ if (static ::isPerformanceTestDebugOutput ()) {
127+ echo "{$ collectionEndpoint }: {$ executionTimeSeconds }\n" ;
128+ }
129+
119130 assertThat ($ executionTimeSeconds , lessThan (MAX_EXECUTION_TIME_SECONDS ));
120131
121132 $ queryCountRanges = self ::getContentNodeEndpointQueryCountRanges ()[$ collectionEndpoint .'/item ' ];
@@ -249,4 +260,8 @@ private function getFixtureFor(string $collectionEndpoint) {
249260 private function getEnvironment (): string {
250261 return static ::$ kernel ->getContainer ()->getParameter ('kernel.environment ' );
251262 }
263+
264+ private static function isPerformanceTestDebugOutput (): bool {
265+ return 'true ' === getenv ('PERFORMANCE_TEST_DEBUG_OUTPUT ' );
266+ }
252267}
0 commit comments