From 851252aefa986ec27fa620644c11384adfa02ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Reyrol?= Date: Fri, 17 Jan 2025 16:15:26 +0100 Subject: [PATCH] test: change functional application psr-4 namespace --- composer.json | 6 ++--- phpunit.xml.dist | 1 - tests/Functional/Application/bin/console | 2 +- .../Application/config/packages/doctrine.yaml | 6 ++--- .../config/packages/doctrine_migrations.yaml | 2 +- .../config/packages/framework.yaml | 2 +- .../config/packages/open_telemetry.yaml | 2 +- .../Functional/Application/config/routes.yaml | 2 +- .../Application/config/services.yaml | 2 +- .../migrations/Version20240229075814.php | 2 +- .../src/Command/FallbackCommand.php | 2 +- .../src/Command/TraceableCommand.php | 2 +- .../Controller/ActionTraceableController.php | 4 +-- .../ClassInvokeTraceableController.php | 2 +- .../Controller/ClassTraceableController.php | 2 +- .../FallbackTraceableController.php | 2 +- .../NotTraceableClassController.php | 2 +- .../Application/src/Entity/Dummy.php | 4 +-- .../Application/{ => src}/Kernel.php | 4 +-- .../Application/src/Message/DummyMessage.php | 2 +- .../src/Message/ExceptionMessage.php | 2 +- .../MessageHandler/DummyMessageHandler.php | 4 +-- .../ExceptionMessageHandler.php | 4 +-- .../src/Repository/DummyRepository.php | 4 +-- .../Application/templates/fragment.html.twig | 2 +- .../Cache/CacheTracingTest.php | 2 +- .../Cache/TagAwareCacheTracingTest.php | 2 +- .../Instrumentation/ConsoleTracingTest.php | 10 +++---- .../Doctrine/DoctrineV4TracingTest.php | 2 +- .../Instrumentation/HttpClientTracingTest.php | 2 +- .../Instrumentation/HttpKernelTracingTest.php | 26 +++++++++---------- .../Instrumentation/MailerTracingTest.php | 2 +- .../Instrumentation/MessengerTracingTest.php | 6 ++--- .../Instrumentation/TwigTracingTest.php | 8 +++--- 34 files changed, 64 insertions(+), 65 deletions(-) rename tests/Functional/Application/{ => src}/Kernel.php (89%) diff --git a/composer.json b/composer.json index f696820..abdbb27 100644 --- a/composer.json +++ b/composer.json @@ -104,9 +104,9 @@ }, "autoload-dev": { "psr-4": { - "FriendsOfOpenTelemetry\\OpenTelemetryBundle\\Tests\\": "tests/", - "FriendsOfOpenTelemetry\\OpenTelemetryBundle\\Tests\\Functional\\Application\\": "tests/Functional/Application/src", - "FriendsOfOpenTelemetry\\OpenTelemetryBundle\\Tests\\Functional\\Application\\Migrations\\": "tests/Functional/Application/migrations" + "App\\": "tests/Functional/Application/src", + "App\\Migrations\\": "tests/Functional/Application/migrations", + "FriendsOfOpenTelemetry\\OpenTelemetryBundle\\Tests\\": "tests/" } }, "config": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ce3c6c3..982e880 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,7 +5,6 @@ executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" failOnRisky="true" - failOnWarning="false" cacheDirectory=".phpunit.cache" > diff --git a/tests/Functional/Application/bin/console b/tests/Functional/Application/bin/console index 9da4567..bcf718c 100755 --- a/tests/Functional/Application/bin/console +++ b/tests/Functional/Application/bin/console @@ -2,7 +2,7 @@ diff --git a/tests/Functional/Application/templates/fragment.html.twig b/tests/Functional/Application/templates/fragment.html.twig index 9b28e70..71bc821 100644 --- a/tests/Functional/Application/templates/fragment.html.twig +++ b/tests/Functional/Application/templates/fragment.html.twig @@ -1,4 +1,4 @@

fragment

- {{ render(controller('FriendsOfOpenTelemetry\\OpenTelemetryBundle\\Tests\\Functional\\Application\\Controller\\ActionTraceableController::view')) }} + {{ render(controller('App\\Controller\\ActionTraceableController::view')) }}

diff --git a/tests/Functional/Instrumentation/Cache/CacheTracingTest.php b/tests/Functional/Instrumentation/Cache/CacheTracingTest.php index c7ba2ed..7970add 100644 --- a/tests/Functional/Instrumentation/Cache/CacheTracingTest.php +++ b/tests/Functional/Instrumentation/Cache/CacheTracingTest.php @@ -2,7 +2,7 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation\Cache; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; +use App\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\SDK\Trace\StatusData; use Psr\Cache\CacheItemInterface; diff --git a/tests/Functional/Instrumentation/Cache/TagAwareCacheTracingTest.php b/tests/Functional/Instrumentation/Cache/TagAwareCacheTracingTest.php index fc28d35..050bc33 100644 --- a/tests/Functional/Instrumentation/Cache/TagAwareCacheTracingTest.php +++ b/tests/Functional/Instrumentation/Cache/TagAwareCacheTracingTest.php @@ -2,7 +2,7 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation\Cache; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; +use App\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\SDK\Trace\StatusData; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; diff --git a/tests/Functional/Instrumentation/ConsoleTracingTest.php b/tests/Functional/Instrumentation/ConsoleTracingTest.php index 1763336..36ba769 100644 --- a/tests/Functional/Instrumentation/ConsoleTracingTest.php +++ b/tests/Functional/Instrumentation/ConsoleTracingTest.php @@ -2,7 +2,7 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; +use App\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\SDK\Trace\SpanExporter\InMemoryExporter; use OpenTelemetry\SDK\Trace\StatusData; @@ -36,7 +36,7 @@ public function testSuccess(): void self::assertSpanStatus($mainSpan, StatusData::ok()); self::assertSpanAttributes($mainSpan, [ 'code.function' => 'execute', - 'code.namespace' => 'FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Command\TraceableCommand', + 'code.namespace' => 'App\Command\TraceableCommand', 'symfony.console.exit_code' => 0, ]); self::assertSpanEventsCount($mainSpan, 0); @@ -64,7 +64,7 @@ public function testFailure(): void self::assertSpanStatus($mainSpan, StatusData::error()); self::assertSpanAttributes($mainSpan, [ 'code.function' => 'execute', - 'code.namespace' => 'FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Command\TraceableCommand', + 'code.namespace' => 'App\Command\TraceableCommand', 'symfony.console.exit_code' => 1, ]); self::assertSpanEventsCount($mainSpan, 0); @@ -97,7 +97,7 @@ public function testException(): void self::assertSpanStatus($mainSpan, StatusData::error()); self::assertSpanAttributes($mainSpan, [ 'code.function' => 'execute', - 'code.namespace' => 'FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Command\TraceableCommand', + 'code.namespace' => 'App\Command\TraceableCommand', 'symfony.console.exit_code' => 1, ]); @@ -133,7 +133,7 @@ public function testFallback(): void self::assertSpanStatus($mainSpan, StatusData::ok()); self::assertSpanAttributes($mainSpan, [ 'code.function' => 'execute', - 'code.namespace' => 'FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Command\FallbackCommand', + 'code.namespace' => 'App\Command\FallbackCommand', 'symfony.console.exit_code' => 0, ]); self::assertSpanEventsCount($mainSpan, 0); diff --git a/tests/Functional/Instrumentation/Doctrine/DoctrineV4TracingTest.php b/tests/Functional/Instrumentation/Doctrine/DoctrineV4TracingTest.php index 1306729..04e3593 100644 --- a/tests/Functional/Instrumentation/Doctrine/DoctrineV4TracingTest.php +++ b/tests/Functional/Instrumentation/Doctrine/DoctrineV4TracingTest.php @@ -2,10 +2,10 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation\Doctrine; +use App\Kernel; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Exception\ConnectionException; use Doctrine\DBAL\Exception\TableNotFoundException; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\API\Trace\StatusCode; use OpenTelemetry\SDK\Trace\StatusData; diff --git a/tests/Functional/Instrumentation/HttpClientTracingTest.php b/tests/Functional/Instrumentation/HttpClientTracingTest.php index 61250ab..1c360ac 100644 --- a/tests/Functional/Instrumentation/HttpClientTracingTest.php +++ b/tests/Functional/Instrumentation/HttpClientTracingTest.php @@ -2,8 +2,8 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation; +use App\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Instrumentation\Symfony\HttpClient\TraceableHttpClient; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\SDK\Trace\StatusData; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; diff --git a/tests/Functional/Instrumentation/HttpKernelTracingTest.php b/tests/Functional/Instrumentation/HttpKernelTracingTest.php index 3af9903..aefcc62 100644 --- a/tests/Functional/Instrumentation/HttpKernelTracingTest.php +++ b/tests/Functional/Instrumentation/HttpKernelTracingTest.php @@ -2,7 +2,7 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; +use App\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\SDK\Trace\StatusData; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -25,7 +25,7 @@ public function testSuccess(): void self::assertSpansCount(1); $mainSpan = self::getSpans()[0]; - self::assertSpanName($mainSpan, 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_ok'); + self::assertSpanName($mainSpan, 'app_actiontraceable_ok'); self::assertSpanStatus($mainSpan, StatusData::ok()); self::assertSpanAttributes($mainSpan, [ 'url.full' => 'http://localhost/ok', @@ -39,7 +39,7 @@ public function testSuccess(): void 'symfony.kernel.net.peer_ip' => '127.0.0.1', 'server.address' => 'localhost', 'server.port' => 80, - 'http.route' => 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_ok', + 'http.route' => 'app_actiontraceable_ok', 'http.response.status_code' => Response::HTTP_OK, ]); self::assertSpanEventsCount($mainSpan, 0); @@ -56,7 +56,7 @@ public function testFailure(): void self::assertSpansCount(1); $mainSpan = self::getSpans()[0]; - self::assertSpanName($mainSpan, 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_failure'); + self::assertSpanName($mainSpan, 'app_actiontraceable_failure'); self::assertSpanStatus($mainSpan, StatusData::error()); self::assertSpanAttributes($mainSpan, [ 'url.full' => 'http://localhost/failure', @@ -70,7 +70,7 @@ public function testFailure(): void 'symfony.kernel.net.peer_ip' => '127.0.0.1', 'server.address' => 'localhost', 'server.port' => 80, - 'http.route' => 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_failure', + 'http.route' => 'app_actiontraceable_failure', 'http.response.status_code' => Response::HTTP_SERVICE_UNAVAILABLE, ]); self::assertSpanEventsCount($mainSpan, 0); @@ -88,7 +88,7 @@ public function testException(): void $spans = self::getSpans(); $mainSpan = $spans[array_key_last($spans)]; - self::assertSpanName($mainSpan, 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_exception'); + self::assertSpanName($mainSpan, 'app_actiontraceable_exception'); self::assertSpanStatus($mainSpan, StatusData::error()); self::assertSpanAttributes($mainSpan, [ 'url.full' => 'http://localhost/exception', @@ -102,7 +102,7 @@ public function testException(): void 'symfony.kernel.net.peer_ip' => '127.0.0.1', 'server.address' => 'localhost', 'server.port' => 80, - 'http.route' => 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_exception', + 'http.route' => 'app_actiontraceable_exception', 'http.response.status_code' => Response::HTTP_INTERNAL_SERVER_ERROR, ]); self::assertSpanEventsCount($mainSpan, 1); @@ -126,7 +126,7 @@ public function testTraceableClassInvoke(): void self::assertSpansCount(1); $mainSpan = self::getSpans()[0]; - self::assertSpanName($mainSpan, 'friendsofopentelemetry_opentelemetry_tests_functional_application_classinvoketraceable__invoke'); + self::assertSpanName($mainSpan, 'app_classinvoketraceable__invoke'); self::assertSpanStatus($mainSpan, StatusData::ok()); self::assertSpanAttributes($mainSpan, [ 'url.full' => 'http://localhost/class-invoke-traceable', @@ -140,7 +140,7 @@ public function testTraceableClassInvoke(): void 'symfony.kernel.net.peer_ip' => '127.0.0.1', 'server.address' => 'localhost', 'server.port' => 80, - 'http.route' => 'friendsofopentelemetry_opentelemetry_tests_functional_application_classinvoketraceable__invoke', + 'http.route' => 'app_classinvoketraceable__invoke', 'http.response.status_code' => Response::HTTP_OK, ]); self::assertSpanEventsCount($mainSpan, 0); @@ -157,7 +157,7 @@ public function testTraceableClass(): void self::assertSpansCount(1); $mainSpan = self::getSpans()[0]; - self::assertSpanName($mainSpan, 'friendsofopentelemetry_opentelemetry_tests_functional_application_classtraceable_index'); + self::assertSpanName($mainSpan, 'app_classtraceable_index'); self::assertSpanStatus($mainSpan, StatusData::ok()); self::assertSpanAttributes($mainSpan, [ 'url.full' => 'http://localhost/class-traceable', @@ -171,7 +171,7 @@ public function testTraceableClass(): void 'symfony.kernel.net.peer_ip' => '127.0.0.1', 'server.address' => 'localhost', 'server.port' => 80, - 'http.route' => 'friendsofopentelemetry_opentelemetry_tests_functional_application_classtraceable_index', + 'http.route' => 'app_classtraceable_index', 'http.response.status_code' => Response::HTTP_OK, ]); self::assertSpanEventsCount($mainSpan, 0); @@ -210,7 +210,7 @@ public function testTraceableFallback(): void self::assertSpansCount(1, 'open_telemetry.traces.exporters.fallback'); $mainSpan = self::getSpans('open_telemetry.traces.exporters.fallback')[0]; - self::assertSpanName($mainSpan, 'friendsofopentelemetry_opentelemetry_tests_functional_application_fallbacktraceable__invoke'); + self::assertSpanName($mainSpan, 'app_fallbacktraceable__invoke'); self::assertSpanStatus($mainSpan, StatusData::ok()); self::assertSpanAttributes($mainSpan, [ 'url.full' => 'http://localhost/fallback-traceable', @@ -224,7 +224,7 @@ public function testTraceableFallback(): void 'symfony.kernel.net.peer_ip' => '127.0.0.1', 'server.address' => 'localhost', 'server.port' => 80, - 'http.route' => 'friendsofopentelemetry_opentelemetry_tests_functional_application_fallbacktraceable__invoke', + 'http.route' => 'app_fallbacktraceable__invoke', 'http.response.status_code' => Response::HTTP_OK, ]); self::assertSpanEventsCount($mainSpan, 0); diff --git a/tests/Functional/Instrumentation/MailerTracingTest.php b/tests/Functional/Instrumentation/MailerTracingTest.php index 6b37e8f..f7b660e 100644 --- a/tests/Functional/Instrumentation/MailerTracingTest.php +++ b/tests/Functional/Instrumentation/MailerTracingTest.php @@ -2,7 +2,7 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; +use App\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\API\Trace\StatusCode; use OpenTelemetry\SDK\Trace\StatusData; diff --git a/tests/Functional/Instrumentation/MessengerTracingTest.php b/tests/Functional/Instrumentation/MessengerTracingTest.php index 82c5c91..0a50293 100644 --- a/tests/Functional/Instrumentation/MessengerTracingTest.php +++ b/tests/Functional/Instrumentation/MessengerTracingTest.php @@ -2,9 +2,9 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Message\DummyMessage; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Message\ExceptionMessage; +use App\Kernel; +use App\Message\DummyMessage; +use App\Message\ExceptionMessage; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\SDK\Trace\StatusData; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; diff --git a/tests/Functional/Instrumentation/TwigTracingTest.php b/tests/Functional/Instrumentation/TwigTracingTest.php index 1596650..91002c4 100644 --- a/tests/Functional/Instrumentation/TwigTracingTest.php +++ b/tests/Functional/Instrumentation/TwigTracingTest.php @@ -2,7 +2,7 @@ namespace FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Instrumentation; -use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\Application\Kernel; +use App\Kernel; use FriendsOfOpenTelemetry\OpenTelemetryBundle\Tests\Functional\TracingTestCaseTrait; use OpenTelemetry\SDK\Trace\StatusData; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -81,7 +81,7 @@ public function testFragment(): void self::assertSpanName($nativeFragmentSpan, 'HTTP GET'); self::assertSpanStatus($nativeFragmentSpan, StatusData::ok()); self::assertSpanAttributes($nativeFragmentSpan, [ - 'url.full' => 'http://localhost/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3DFriendsOfOpenTelemetry%255COpenTelemetryBundle%255CTests%255CFunctional%255CApplication%255CController%255CActionTraceableController%253A%253Aview', + 'url.full' => 'http://localhost/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3DApp%255CController%255CActionTraceableController%253A%253Aview', 'http.request.method' => 'GET', 'url.path' => '/_fragment', 'symfony.kernel.http.host' => 'localhost', @@ -103,7 +103,7 @@ public function testFragment(): void self::assertSpanEventsCount($fragmentSpan, 0); $mainSpan = self::getSpans()[4]; - self::assertSpanName($mainSpan, 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_segment'); + self::assertSpanName($mainSpan, 'app_actiontraceable_segment'); self::assertSpanStatus($mainSpan, StatusData::ok()); self::assertSpanAttributes($mainSpan, [ 'url.full' => 'http://localhost/fragment', @@ -117,7 +117,7 @@ public function testFragment(): void 'symfony.kernel.net.peer_ip' => '127.0.0.1', 'server.address' => 'localhost', 'server.port' => 80, - 'http.route' => 'friendsofopentelemetry_opentelemetry_tests_functional_application_actiontraceable_segment', + 'http.route' => 'app_actiontraceable_segment', 'http.response.status_code' => 200, ]); self::assertSpanEventsCount($mainSpan, 0);