From 915fcfaaeb498f783a230b4830264c818b89a8f5 Mon Sep 17 00:00:00 2001 From: butschster Date: Sun, 28 Jul 2024 14:14:50 +0400 Subject: [PATCH 1/3] Adds default project on buggregator startup. When an event is received without project it will be attached to the default one. --- ...465_1_1_default_create_default_project.php | 42 +++++++++++++++++++ .../Interfaces/Commands/StoreEventHandler.php | 5 ++- app/modules/Projects/Domain/Project.php | 4 +- .../Projects/Domain/ProjectInterface.php | 13 ++++++ .../Http/Resources/ProjectResource.php | 8 ++-- .../Interfaces/Centrifugo/ConnectService.php | 3 +- .../Http/Controller/SettingsAction.php | 5 +++ .../Http/HttpDumps/HttpDumpsActionTest.php | 20 ++++----- .../Http/Inspector/InspectorActionTest.php | 9 ++-- .../Http/Profiler/ProfilerActionTest.php | 9 ++-- .../Interfaces/Http/Ray/RayActionTest.php | 32 +++++++------- .../Http/Sentry/SentryEventActionTest.php | 6 +-- .../Http/Sentry/SentryV3ActionTest.php | 8 ++-- .../Http/Sentry/SentryV4ActionTest.php | 16 +++---- .../Http/Sentry/SentryVueEventActionTest.php | 6 +-- .../TCP/Monolog/JsonPayloadTest.php | 16 +++---- .../Feature/Interfaces/TCP/Smtp/EmailTest.php | 6 +-- .../TCP/VarDumper/SymfonyV6Test.php | 2 +- .../TCP/VarDumper/SymfonyV7Test.php | 20 ++++----- 19 files changed, 149 insertions(+), 81 deletions(-) create mode 100644 app/database/Migrations/20240728.115465_1_1_default_create_default_project.php create mode 100644 app/modules/Projects/Domain/ProjectInterface.php diff --git a/app/database/Migrations/20240728.115465_1_1_default_create_default_project.php b/app/database/Migrations/20240728.115465_1_1_default_create_default_project.php new file mode 100644 index 00000000..b0e22d6d --- /dev/null +++ b/app/database/Migrations/20240728.115465_1_1_default_create_default_project.php @@ -0,0 +1,42 @@ +getEntityManager() + ->persist(new Project(Key::create(Project::DEFAULT_KEY), 'Default project')) + ->run(); + } + + public function down(): void + { + $defaultProject = $this->getRepository()->findOne(['key' => Project::DEFAULT_KEY]); + if ($defaultProject) { + $this->getEntityManager()->delete($defaultProject)->run(); + } + } + + private function getEntityManager(): EntityManagerInterface + { + return ContainerScope::getContainer()->get(EntityManagerInterface::class); + } + + private function getRepository(): ProjectRepositoryInterface + { + return ContainerScope::getContainer()->get(ProjectRepositoryInterface::class); + } +} diff --git a/app/modules/Events/Interfaces/Commands/StoreEventHandler.php b/app/modules/Events/Interfaces/Commands/StoreEventHandler.php index 012ac9bd..74f6d413 100644 --- a/app/modules/Events/Interfaces/Commands/StoreEventHandler.php +++ b/app/modules/Events/Interfaces/Commands/StoreEventHandler.php @@ -12,6 +12,8 @@ use Modules\Events\Domain\EventRepositoryInterface; use Modules\Events\Domain\Events\EventWasReceived; use Modules\Events\Domain\ValueObject\Timestamp; +use Modules\Projects\Domain\Project; +use Modules\Projects\Domain\ValueObject\Key; use Psr\EventDispatcher\EventDispatcherInterface; use Spiral\Cqrs\Attribute\CommandHandler; use Spiral\Cqrs\QueryBusInterface; @@ -40,7 +42,8 @@ public function handle(HandleReceivedEvent $command): void type: $command->type, payload: new Json($command->payload), timestamp: Timestamp::create(), - project: $project?->getKey(), + // todo: use better option for default project + project: $project?->getKey() ?? Key::create(Project::DEFAULT_KEY), ), ); diff --git a/app/modules/Projects/Domain/Project.php b/app/modules/Projects/Domain/Project.php index b4caff46..f23a8a5d 100644 --- a/app/modules/Projects/Domain/Project.php +++ b/app/modules/Projects/Domain/Project.php @@ -11,8 +11,10 @@ #[Entity( repository: ProjectRepositoryInterface::class, )] -class Project +class Project implements ProjectInterface { + public const DEFAULT_KEY = 'default'; + /** @internal */ public function __construct( #[Column(type: 'string(36)', primary: true, typecast: Key::class)] diff --git a/app/modules/Projects/Domain/ProjectInterface.php b/app/modules/Projects/Domain/ProjectInterface.php new file mode 100644 index 00000000..99e79343 --- /dev/null +++ b/app/modules/Projects/Domain/ProjectInterface.php @@ -0,0 +1,13 @@ +bus->ask(new FindAllProjects()); /** @var non-empty-string[] $channels */ - $channels = [(string) new EventsChannel()]; - + $channels = []; foreach ($projects as $project) { $channels[] = (string) new EventsChannel($project->getKey()); } diff --git a/app/src/Interfaces/Http/Controller/SettingsAction.php b/app/src/Interfaces/Http/Controller/SettingsAction.php index 0b4a3ef4..bb803a0f 100644 --- a/app/src/Interfaces/Http/Controller/SettingsAction.php +++ b/app/src/Interfaces/Http/Controller/SettingsAction.php @@ -9,6 +9,7 @@ use App\Application\HTTP\Response\JsonResource; use App\Application\HTTP\Response\ResourceInterface; use App\Application\Ide\UrlTemplate; +use Modules\Projects\Domain\Project; use Spiral\Boot\EnvironmentInterface; use Spiral\Router\Annotation\Route; @@ -30,6 +31,10 @@ public function __invoke( 'url_template' => $ideUrl->template, ], 'version' => $appVersion->version, + 'project' => [ + // todo: use better option for default project + 'default' => Project::DEFAULT_KEY, + ], ]); } } diff --git a/tests/Feature/Interfaces/Http/HttpDumps/HttpDumpsActionTest.php b/tests/Feature/Interfaces/Http/HttpDumps/HttpDumpsActionTest.php index b19b150f..98202737 100644 --- a/tests/Feature/Interfaces/Http/HttpDumps/HttpDumpsActionTest.php +++ b/tests/Feature/Interfaces/Http/HttpDumps/HttpDumpsActionTest.php @@ -18,10 +18,10 @@ public function testHttpDumpViaHttpUser(): void ) ->assertOk(); - $this->broadcastig->assertPushed('events', function (array $data) { + $this->broadcastig->assertPushed('events.project.default', function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('http-dump', $data['data']['type']); - $this->assertSame(null, $data['data']['project']); + $this->assertSame('default', $data['data']['project']); $this->assertSame('{"foo":"bar"}', $data['data']['payload']['request']['body']); return true; @@ -51,7 +51,7 @@ public function testHttpDumpViaHttpUserWithProject(): void public function testHttpDumpWithProjectFromHeader(): void { - $this->createProject('default'); + $this->createProject('foo'); $this->http ->postJson( @@ -59,16 +59,16 @@ public function testHttpDumpWithProjectFromHeader(): void data: ['foo' => 'bar'], headers: [ 'X-Buggregator-Event' => 'http-dump', - 'X-Buggregator-Project' => 'default', + 'X-Buggregator-Project' => 'foo', ], cookies: ['foo' => 'bar'], ) ->assertOk(); - $this->broadcastig->assertPushed((string) new EventsChannel('default'), function (array $data) { + $this->broadcastig->assertPushed((string) new EventsChannel('foo'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('http-dump', $data['data']['type']); - $this->assertSame('default', $data['data']['project']); + $this->assertSame('foo', $data['data']['project']); return true; }); @@ -85,10 +85,10 @@ public function testHttpDumpsPost(): void ) ->assertOk(); - $this->broadcastig->assertPushed('events', function (array $data) { + $this->broadcastig->assertPushed('events.project.default', function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('http-dump', $data['data']['type']); - $this->assertSame(null, $data['data']['project']); + $this->assertSame('default', $data['data']['project']); $this->assertSame('POST', $data['data']['payload']['request']['method']); $this->assertSame('', $data['data']['payload']['request']['uri']); $this->assertSame(['http-dump'], $data['data']['payload']['request']['headers']['X-Buggregator-Event']); @@ -117,7 +117,7 @@ public function testHttpDumpsGet(): void ) ->assertOk(); - $this->broadcastig->assertPushed('events', function (array $data) { + $this->broadcastig->assertPushed('events.project.default', function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('http-dump', $data['data']['type']); $this->assertSame('GET', $data['data']['payload']['request']['method']); @@ -148,7 +148,7 @@ public function testHttpDumpsDelete(): void ) ->assertOk(); - $this->broadcastig->assertPushed('events', function (array $data) { + $this->broadcastig->assertPushed('events.project.default', function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('http-dump', $data['data']['type']); $this->assertSame('DELETE', $data['data']['payload']['request']['method']); diff --git a/tests/Feature/Interfaces/Http/Inspector/InspectorActionTest.php b/tests/Feature/Interfaces/Http/Inspector/InspectorActionTest.php index e3df98f7..85fb04bf 100644 --- a/tests/Feature/Interfaces/Http/Inspector/InspectorActionTest.php +++ b/tests/Feature/Interfaces/Http/Inspector/InspectorActionTest.php @@ -57,11 +57,12 @@ public function testSendDataWithClientHeaders(): void public function testSendDataWithProject(): void { - $this->createProject('default'); + $project = 'foo'; + $this->createProject($project); $this->http ->post( - uri: 'http://inspector:default@localhost/', + uri: 'http://inspector:'.$project.'@localhost/', data: Stream::create(self::PAYLOAD), headers: [ 'X-Inspector-Key' => 'test', @@ -69,7 +70,7 @@ public function testSendDataWithProject(): void ], )->assertOk(); - $this->assertEvent('default'); + $this->assertEvent($project); } #[Env('INSPECTOR_SECRET_KEY', 'test')] @@ -102,7 +103,7 @@ public function testSendDataWithWrongSecretKey(): void )->assertForbidden(); } - public function assertEvent(?string $project = null): void + public function assertEvent(string $project = 'default'): void { $this->broadcastig->assertPushed((string) new EventsChannel($project), function (array $data) use($project) { $this->assertSame('event.received', $data['event']); diff --git a/tests/Feature/Interfaces/Http/Profiler/ProfilerActionTest.php b/tests/Feature/Interfaces/Http/Profiler/ProfilerActionTest.php index 0c6b3de7..e817d29a 100644 --- a/tests/Feature/Interfaces/Http/Profiler/ProfilerActionTest.php +++ b/tests/Feature/Interfaces/Http/Profiler/ProfilerActionTest.php @@ -25,12 +25,13 @@ public function testSendData(): void ], )->assertOk(); - $this->assertEvent(); + $this->assertEvent('default'); } public function testSendDataWithProject(): void { - $this->createProject('default'); + $project = 'foo'; + $this->createProject($project); $this->http ->post( @@ -38,11 +39,11 @@ public function testSendDataWithProject(): void data: Stream::create(self::PAYLOAD), headers: [ 'X-Buggregator-Event' => 'profiler', - 'X-Buggregator-Project' => 'default', + 'X-Buggregator-Project' => $project, ], )->assertOk(); - $this->assertEvent('default'); + $this->assertEvent($project); } public function testSendInvalidPayload(): void diff --git a/tests/Feature/Interfaces/Http/Ray/RayActionTest.php b/tests/Feature/Interfaces/Http/Ray/RayActionTest.php index 6013ba3d..c454d51e 100644 --- a/tests/Feature/Interfaces/Http/Ray/RayActionTest.php +++ b/tests/Feature/Interfaces/Http/Ray/RayActionTest.php @@ -16,18 +16,19 @@ final class RayActionTest extends RayTestCase public function testSendDump(): void { - $this->createProject('default'); + $project = 'foo'; + $this->createProject($project); $this->http->postJson( uri: '/', data: Stream::create(self::PAYLOAD), headers: [ 'X-Buggregator-Event' => 'ray', - 'X-Buggregator-Project' => 'default', + 'X-Buggregator-Project' => $project, ], )->assertOk(); - $this->assertEventSent('default'); + $this->assertEventSent($project); } public function testSendDumpWithProject(): void @@ -40,7 +41,7 @@ public function testSendDumpWithProject(): void ], )->assertOk(); - $this->assertEventSent(); + $this->assertEventSent('default'); } public function testSendDumpViaHttpAuth(): void @@ -50,19 +51,20 @@ public function testSendDumpViaHttpAuth(): void data: Stream::create(self::PAYLOAD), )->assertOk(); - $this->assertEventSent(); + $this->assertEventSent('default'); } public function testSendDumpViaHttpAuthWithProjectId(): void { - $this->createProject('default'); + $project = 'foo'; + $this->createProject($project); $this->http->postJson( - uri: 'http://ray:default@localhost', + uri: 'http://ray:' . $project . '@localhost', data: Stream::create(self::PAYLOAD), )->assertOk(); - $this->assertEventSent('default'); + $this->assertEventSent($project); } public function testSendDumpViaUserAgent(): void @@ -76,7 +78,7 @@ public function testSendDumpViaUserAgent(): void data: Stream::create(self::PAYLOAD), )->assertOk(); - $this->assertEventSent(); + $this->assertEventSent('default'); } public function testSendDumpWithMerge(): void @@ -102,7 +104,7 @@ public function testSendDumpWithMerge(): void headers: ['X-Buggregator-Event' => 'ray'], )->assertOk(); - $this->broadcastig->assertPushed('events', function (array $data) { + $this->broadcastig->assertPushed('events.project.default', function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('ray', $data['data']['type']); @@ -162,7 +164,7 @@ public function testSendBoolean(): void { $this->dump(true); - $this->broadcastig->assertPushed((string) new EventsChannel(), function (array $data) { + $this->broadcastig->assertPushed((string) new EventsChannel('default'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('ray', $data['data']['type']); @@ -178,7 +180,7 @@ public function testSendNumber(): void { $this->dump(1); - $this->broadcastig->assertPushed((string) new EventsChannel(), function (array $data) { + $this->broadcastig->assertPushed((string) new EventsChannel('default'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('ray', $data['data']['type']); @@ -193,7 +195,7 @@ public function testSendString(): void { $this->dump('Hello, world!'); - $this->broadcastig->assertPushed((string) new EventsChannel(), function (array $data) { + $this->broadcastig->assertPushed((string) new EventsChannel('default'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('ray', $data['data']['type']); @@ -208,7 +210,7 @@ public function testSendArray(): void { $this->dump(['foo' => 'bar']); - $this->broadcastig->assertPushed((string) new EventsChannel(), function (array $data) { + $this->broadcastig->assertPushed((string) new EventsChannel('default'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('ray', $data['data']['type']); @@ -236,7 +238,7 @@ public function testSendObject(): void $this->dump($object); $id = \spl_object_id($object); - $this->broadcastig->assertPushed((string) new EventsChannel(), function (array $data) use($id) { + $this->broadcastig->assertPushed((string) new EventsChannel('default'), function (array $data) use ($id) { $this->assertSame('event.received', $data['event']); $this->assertSame('ray', $data['data']['type']); diff --git a/tests/Feature/Interfaces/Http/Sentry/SentryEventActionTest.php b/tests/Feature/Interfaces/Http/Sentry/SentryEventActionTest.php index 83899866..46f49763 100644 --- a/tests/Feature/Interfaces/Http/Sentry/SentryEventActionTest.php +++ b/tests/Feature/Interfaces/Http/Sentry/SentryEventActionTest.php @@ -18,7 +18,7 @@ protected function setUp(): void { parent::setUp(); - $this->project = $this->createProject('default'); + $this->project = $this->createProject('foo'); } public function testSendWithoutGzip(): void @@ -29,7 +29,7 @@ public function testSendWithoutGzip(): void $this->broadcastig->assertPushed(new EventsChannel($this->project->getKey()), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('sentry', $data['data']['type']); - $this->assertSame('default', $data['data']['project']); + $this->assertSame('foo', $data['data']['project']); $this->assertSame('production', $data['data']['payload']['environment']); $this->assertSame('Hello world', $data['data']['payload']['message']); @@ -45,7 +45,7 @@ public function testSendWithoutGzip(): void private function makeRequest( string $payload, string $secret = 'secret', - string|Key $project = 'default', + string|Key $project = 'foo', ): ResponseAssertions { return $this->http ->postJson( diff --git a/tests/Feature/Interfaces/Http/Sentry/SentryV3ActionTest.php b/tests/Feature/Interfaces/Http/Sentry/SentryV3ActionTest.php index 9c5d0061..ff2678c8 100644 --- a/tests/Feature/Interfaces/Http/Sentry/SentryV3ActionTest.php +++ b/tests/Feature/Interfaces/Http/Sentry/SentryV3ActionTest.php @@ -24,7 +24,7 @@ protected function setUp(): void { parent::setUp(); - $this->project = $this->createProject('default'); + $this->project = $this->createProject('foo'); } public function testSend(): void @@ -36,7 +36,7 @@ public function testSend(): void public function testSendWithNonExistsProject(): void { $this->makeRequest(project: 'non-exists'); - $this->assertEventSent(); + $this->assertEventSent('default'); } #[Env('SENTRY_SECRET_KEY', 'secret')] @@ -60,7 +60,7 @@ public function assertEventSent(Key|string|null $project = null): void $this->broadcastig->assertPushed(new EventsChannel($project), function (array $data) use ($project) { $this->assertSame('event.received', $data['event']); $this->assertSame('sentry', $data['data']['type']); - $this->assertSame($project ? (string) $project : null, $data['data']['project']); + $this->assertSame($project ? (string) $project : 'default', $data['data']['project']); $this->assertSame('f7b7f09d40e645c79a8a2846e2111c81', $data['data']['payload']['event_id']); $this->assertSame('php', $data['data']['payload']['platform']); @@ -75,7 +75,7 @@ public function assertEventSent(Key|string|null $project = null): void }); } - private function makeRequest(string $secret = 'secret', string|Key $project = 'default'): ResponseAssertions + private function makeRequest(string $secret = 'secret', string|Key $project = 'foo'): ResponseAssertions { return $this->http ->postJson( diff --git a/tests/Feature/Interfaces/Http/Sentry/SentryV4ActionTest.php b/tests/Feature/Interfaces/Http/Sentry/SentryV4ActionTest.php index b94a2ae8..d0d6bba9 100644 --- a/tests/Feature/Interfaces/Http/Sentry/SentryV4ActionTest.php +++ b/tests/Feature/Interfaces/Http/Sentry/SentryV4ActionTest.php @@ -25,7 +25,7 @@ protected function setUp(): void { parent::setUp(); - $this->project = $this->createProject('default'); + $this->project = $this->createProject('foo'); } public function testSendWithoutGzip(): void @@ -35,7 +35,7 @@ public function testSendWithoutGzip(): void $this->broadcastig->assertPushed(new EventsChannel($this->project->getKey()), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('sentry', $data['data']['type']); - $this->assertSame('default', $data['data']['project']); + $this->assertSame((string) $this->project->getKey(), $data['data']['project']); $this->assertSame('Test', $data['data']['payload']['server_name']); $this->assertSame('production', $data['data']['payload']['environment']); @@ -53,7 +53,7 @@ public function testSendGzipped(): void { $this->http ->postJson( - uri: '/api/default/envelope/', + uri: '/api/foo/envelope/', data: Stream::create(\gzcompress(self::JSON, -1, \ZLIB_ENCODING_GZIP)), headers: [ 'Content-Encoding' => 'gzip', @@ -63,10 +63,10 @@ public function testSendGzipped(): void ], )->assertOk(); - $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) { + $this->broadcastig->assertPushed(new EventsChannel('foo'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('sentry', $data['data']['type']); - $this->assertSame('default', $data['data']['project']); + $this->assertSame('foo', $data['data']['project']); $this->assertSame('Test', $data['data']['payload']['server_name']); $this->assertSame('production', $data['data']['payload']['environment']); @@ -83,7 +83,7 @@ public function testSendGzippedSpiral(): void { $this->http ->postJson( - uri: '/api/default/envelope/', + uri: '/api/foo/envelope/', data: Stream::create(\gzcompress(self::JSON, -1, \ZLIB_ENCODING_GZIP)), headers: [ 'Content-Encoding' => 'gzip', @@ -93,7 +93,7 @@ public function testSendGzippedSpiral(): void ], )->assertOk(); - $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) { + $this->broadcastig->assertPushed(new EventsChannel('foo'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('sentry', $data['data']['type']); @@ -107,7 +107,7 @@ public function testSendGzippedSpiral(): void }); } - private function makeRequest(string $secret = 'secret', string|Key $project = 'default'): ResponseAssertions + private function makeRequest(string $secret = 'secret', string|Key $project = 'foo'): ResponseAssertions { return $this->http ->postJson( diff --git a/tests/Feature/Interfaces/Http/Sentry/SentryVueEventActionTest.php b/tests/Feature/Interfaces/Http/Sentry/SentryVueEventActionTest.php index e5232cd7..1225735c 100644 --- a/tests/Feature/Interfaces/Http/Sentry/SentryVueEventActionTest.php +++ b/tests/Feature/Interfaces/Http/Sentry/SentryVueEventActionTest.php @@ -25,7 +25,7 @@ protected function setUp(): void { parent::setUp(); - $this->project = $this->createProject('default'); + $this->project = $this->createProject('foo'); } public function testSend(): void @@ -35,7 +35,7 @@ public function testSend(): void $this->broadcastig->assertPushed(new EventsChannel($this->project->getKey()), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('sentry', $data['data']['type']); - $this->assertSame('default', $data['data']['project']); + $this->assertSame('foo', $data['data']['project']); $this->assertNull($data['data']['payload']['server_name']); $this->assertSame('production', $data['data']['payload']['environment']); @@ -55,7 +55,7 @@ public function testSend(): void }); } - private function makeRequest(string $secret = 'secret', string|Key $project = 'default'): ResponseAssertions + private function makeRequest(string $secret = 'secret', string|Key $project = 'foo'): ResponseAssertions { return $this->http ->postJson( diff --git a/tests/Feature/Interfaces/TCP/Monolog/JsonPayloadTest.php b/tests/Feature/Interfaces/TCP/Monolog/JsonPayloadTest.php index 5f74ea42..9948ed7a 100644 --- a/tests/Feature/Interfaces/TCP/Monolog/JsonPayloadTest.php +++ b/tests/Feature/Interfaces/TCP/Monolog/JsonPayloadTest.php @@ -15,10 +15,10 @@ public function testSendDump(): void $message = \json_encode($payload = $this->buildMessage()); $this->handleMonologRequest($message); - $this->broadcastig->assertPushed(new EventsChannel(), function (array $data) use ($payload) { + $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) use ($payload) { $this->assertSame('event.received', $data['event']); $this->assertSame('monolog', $data['data']['type']); - $this->assertSame(null, $data['data']['project']); + $this->assertSame('default', $data['data']['project']); $this->assertSame($payload, $data['data']['payload']); @@ -31,24 +31,24 @@ public function testSendDump(): void public function testSendDumpWithProject(): void { - $project = $this->createProject('default'); + $project = $this->createProject('foo'); $message = \json_encode($this->buildMessage($project->getKey())); $this->handleMonologRequest($message); - $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) { - $this->assertSame('default', $data['data']['project']); + $this->broadcastig->assertPushed(new EventsChannel('foo'), function (array $data) { + $this->assertSame('foo', $data['data']['project']); return true; }); } public function testSendDumpWithNonExistProject(): void { - $message = \json_encode($this->buildMessage('default')); + $message = \json_encode($this->buildMessage('foo')); $this->handleMonologRequest($message); - $this->broadcastig->assertNotPushed(new EventsChannel('default')); - $this->broadcastig->assertPushed(new EventsChannel()); + $this->broadcastig->assertNotPushed(new EventsChannel('foo')); + $this->broadcastig->assertPushed(new EventsChannel('default')); } private function buildMessage(Key|string|null $project = null): array diff --git a/tests/Feature/Interfaces/TCP/Smtp/EmailTest.php b/tests/Feature/Interfaces/TCP/Smtp/EmailTest.php index ef2c691c..5eb6d256 100644 --- a/tests/Feature/Interfaces/TCP/Smtp/EmailTest.php +++ b/tests/Feature/Interfaces/TCP/Smtp/EmailTest.php @@ -36,7 +36,7 @@ protected function setUp(): void public function testSendEmail(): void { - $project = $this->createProject('default'); + $project = $this->createProject('foo'); $email = $this->buildEmail(); $email->getHeaders()->addIdHeader('Message-ID', $id = $email->generateMessageId()); @@ -113,7 +113,7 @@ public function testSendEmail(): void $response = $this->handleSmtpRequest(message: '', event: TCPEvent::Close); $this->assertInstanceOf(CloseConnection::class, $response); - $this->assertEventPushed($sentMessage, 'default'); + $this->assertEventPushed($sentMessage, 'foo'); } @@ -126,7 +126,7 @@ private function validateMessage(string $messageId, string $uuid): void { $messageData = $this->getEmailMessage($uuid); - $this->assertSame('default', $messageData->username); + $this->assertSame('foo', $messageData->username); $this->assertSame('password', $messageData->password); $this->assertSame('no-reply@site.com', $messageData->from); $this->assertSame([ diff --git a/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV6Test.php b/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV6Test.php index 2cd67799..16148023 100644 --- a/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV6Test.php +++ b/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV6Test.php @@ -15,7 +15,7 @@ public function testSendDump(): void $this->handleVarDumperRequest($payload); - $this->broadcastig->assertPushed(new EventsChannel(), function (array $data) { + $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('var-dump', $data['data']['type']); diff --git a/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV7Test.php b/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV7Test.php index abd7522c..774222f5 100644 --- a/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV7Test.php +++ b/tests/Feature/Interfaces/TCP/VarDumper/SymfonyV7Test.php @@ -61,7 +61,7 @@ public function testSendDump(mixed $value, string $type, mixed $expected): void $expected = \sprintf($expected, \spl_object_id($value)); } - $this->broadcastig->assertPushed(new EventsChannel(), function (array $data) use ($value, $type, $expected) { + $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) use ($value, $type, $expected) { $this->assertSame('event.received', $data['event']); $this->assertSame('var-dump', $data['data']['type']); @@ -83,7 +83,7 @@ public function testSendDumpWithCodeHighlighting(): void $message = $this->buildPayload(var: 'foo', context: ['language' => 'php']); $this->handleVarDumperRequest($message); - $this->broadcastig->assertPushed(new EventsChannel(), function (array $data) { + $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) { $this->assertSame('event.received', $data['event']); $this->assertSame('var-dump', $data['data']['type']); @@ -100,24 +100,24 @@ public function testSendDumpWithCodeHighlighting(): void public function testSendDumpWithProject(): void { - $this->createProject('default'); - $message = $this->buildPayload(project: 'default'); + $this->createProject('foo'); + $message = $this->buildPayload(project: 'foo'); $this->handleVarDumperRequest($message); - $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) { - $this->assertSame('default', $data['data']['project']); + $this->broadcastig->assertPushed(new EventsChannel('foo'), function (array $data) { + $this->assertSame('foo', $data['data']['project']); return true; }); } public function testSendDumpWithNonExistsProject(): void { - $message = $this->buildPayload(project: 'default'); + $message = $this->buildPayload(project: 'foo'); $this->handleVarDumperRequest($message); - $this->broadcastig->assertNotPushed(new EventsChannel('default')); - $this->broadcastig->assertPushed(new EventsChannel(), function (array $data) { - $this->assertSame(null, $data['data']['project']); + $this->broadcastig->assertNotPushed(new EventsChannel('foo')); + $this->broadcastig->assertPushed(new EventsChannel('default'), function (array $data) { + $this->assertSame('default', $data['data']['project']); return true; }); } From 75bb40d58ab46929b2dca50de2a5cfb80d87e80d Mon Sep 17 00:00:00 2001 From: butschster Date: Sun, 28 Jul 2024 14:18:55 +0400 Subject: [PATCH 2/3] Fixes cs --- .../20240728.115465_1_1_default_create_default_project.php | 2 +- app/modules/Profiler/Interfaces/Http/Handler/EventHandler.php | 2 +- composer.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/database/Migrations/20240728.115465_1_1_default_create_default_project.php b/app/database/Migrations/20240728.115465_1_1_default_create_default_project.php index b0e22d6d..bffe33af 100644 --- a/app/database/Migrations/20240728.115465_1_1_default_create_default_project.php +++ b/app/database/Migrations/20240728.115465_1_1_default_create_default_project.php @@ -25,7 +25,7 @@ public function up(): void public function down(): void { $defaultProject = $this->getRepository()->findOne(['key' => Project::DEFAULT_KEY]); - if ($defaultProject) { + if ($defaultProject !== null) { $this->getEntityManager()->delete($defaultProject)->run(); } } diff --git a/app/modules/Profiler/Interfaces/Http/Handler/EventHandler.php b/app/modules/Profiler/Interfaces/Http/Handler/EventHandler.php index 94b28a9e..ab92400f 100644 --- a/app/modules/Profiler/Interfaces/Http/Handler/EventHandler.php +++ b/app/modules/Profiler/Interfaces/Http/Handler/EventHandler.php @@ -88,7 +88,7 @@ private function validatePayload(mixed $payload): void } } - if (!empty($errors)) { + if ($errors !== []) { throw new ValidationException($errors); } } diff --git a/composer.json b/composer.json index 865ea18a..78ea0af6 100644 --- a/composer.json +++ b/composer.json @@ -95,6 +95,7 @@ "rr get-binary" ], "psalm": "vendor/bin/psalm --config=psalm.xml ./app", + "rector": "vendor/bin/rector process --dry-run", "cs-check": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run", "cs-fix": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -vvv --using-cache=no", "deptrack": [ From 098b7d618adc186a85ce35a531f74600ecd53147 Mon Sep 17 00:00:00 2001 From: butschster Date: Sun, 28 Jul 2024 14:22:30 +0400 Subject: [PATCH 3/3] Fixes unit tests --- .../Http/Sentry/SentryVueReplayActionTest.php | 200 +++++++++--------- .../Sentry/SentryVueTransactionActionTest.php | 4 +- 2 files changed, 102 insertions(+), 102 deletions(-) diff --git a/tests/Feature/Interfaces/Http/Sentry/SentryVueReplayActionTest.php b/tests/Feature/Interfaces/Http/Sentry/SentryVueReplayActionTest.php index 99424e30..567c3c93 100644 --- a/tests/Feature/Interfaces/Http/Sentry/SentryVueReplayActionTest.php +++ b/tests/Feature/Interfaces/Http/Sentry/SentryVueReplayActionTest.php @@ -1,100 +1,100 @@ -ddÅ%[vWoé’Å«W$:’¤3Oãívš$èÿ€Cú–¤˜lÐóºÇ,6[ÑvHè+¶ÛÇِ7b"g’o¾ Ãé*6YãŽ$¼ígzb M¯£ý!ÕH«Öˆ¦·,¾ùŽ¦$ Éû8Ĉ5 “üá+²O1ý–­ªÁÉgoé`Fþ@ɊÆÕçÉœ¢å9ãýœ½[¡A=€—Û \ý„VŒÓ*6Ed‡ ¨Â.äR8,Â`ùbèà.¹ORºSwþû…É ß -ÃIšÆÁâòI>vBqÓ¨µ©¿d•a´¸Ï+“/·$N($Ùyÿó÷ÂoA# AaÝT`ÆñïÒ2:ƒý£AY‡h±L2¶LR‹¸È1 ·{§x¾dQJ#>‡˜ý劃%uÅM× ¢ -Hè&0búÒë -lXL,X¤AÒ¶Œb$ ä•Fék¼üI™=ÈÙà*jgKÒûêl²£Ý_&ÜpEvAJ]ërˆ~ÌXڏéž%}²ß'ýぺû˜} Ë´ŸÄË>I ñ¤¿#AÔãPZ1琝ŽëSwéÞn1ïÜùb-^/ -ÍnÂÖ)6å?¥g;ÐßùüG?[„dyƒfoÊŠÍ -œ/^¥gœ?å?úY­‚ -ãíË! -tû*8ð nÈÒõæN¼YçãA×Qƒž?ûÊÒ߯íïùÕþ+ßhðÓ«®£þ½ñÈÒ]A/v¿šæݹ@rԏ$~^ ·¶c=Îãq©³BØ*ÄU×Mô‡£®“¿êº?䊲d!‹ÝÄ´‰Ù!ZYÀ—»Iy—ûŠæú™Tðfsb% ýJò­tv·ìØ8Ä3†pçD›BoSdFWÞÜÜ/Á"tº²Ÿ;Þž¬ý׎cç9ëÑMK–[ºý\8_9¯#Çi)aB-e›bKäöÙN™n#‚LiÛH Ò³^…‡ëèáë®3Ÿ/èšÅ”_‘uJc°tÁîÜ$øŸ˜Fbˆ¦Ύě š;BRk¸M÷V„½¹±xGB]°Õ= 삘fϼÁà¸}á¤>9†À¤*¹2çÑ)I” Ä1Ì/ÃG‰CIBAÒ5€d£ _8ä4Ǩ7–ø¯É.ïçÎk„€¸ë¸ˆ'!¬P$<]ç[þ$Ëwâþ{ è:םwtèóþõu§ë¼e –²®óæî~C£®ó~qˆÒC×A¾š’˜†!ð}çÐç#®;ßÅ,X÷?ÐðHÓ`IœŸèò¶Ï`q€ #Є0 xވó]H1¦¤"Äs瞇t,‚0Hï¡·tq€<1xCي¾À -9B¦¬ «/@-—¹Ë’ÌàO…l -A;䐲Ξ¬2µócº³ ŸtÞ&¦4ÔLÙxòN2¡E,¢Z à\ŸÃK{ÓÞ|î©Mù’0äaÁŸž~XpÒnÄ?éÈ\Üq-.i„téÆ´"JSP ¹æ*n ü«ý„+{$û@cÖ!&¸F -G¼K –È"h,À9Žd®î¿‰ðœ¿Cí±BÁú„£uØEé­cþgÐÉ9Ÿ±š#dzªäH™är€gBž§²,oð'¤YK¬~ Ó©T8d¿°8\õÐëŸø{Æçx)¦†ÐMï^ž%K¶§«—Ô›P2›xÏøÂà¼mëýšaê* ¿Çe - -Fã÷Ƃ CjÌ*y„2¦ Çõ²À³ZaKóëIO!¦Ä©AHڀ|^ TØìpÃ}™RšS -ø¤³†t6ªÖP«–m­wIÕúf¿o¡H2!ÃÉâQŠ$ÖΊK -çR)PŒ¸3¼+Dz‡^È6¬n¸¶w±·Põ¤Ê¨#r¬®?ø²èú}íúKz“Mà -UÎa;¤χH¸¢—Þ‘%F"Ý:Òºií±ù\` -ÞWxø=¢bÄUOÀmä` YHF<£'•© ×epÍ Y )„è¢é¨¢»â$uÙÚåŠ"RŸ,y+&£6›´«Q›8!IrãL·°p_>ϐ72㯜¾#c|€MíL5ãZ .2r<Þm s;aÞäb/†àÄ5‡3wø»œÀ¢ÎU—#Õ5“™›ÉÑÔóÌW+Yóی SͳN -Îk¤—±ùgÄÅ_hˆ;úlláÏ«Ùb¸ŽáÏz\RJ -N®¦{( º&.>ôVbÿ2©ƒÈ‡Aøá>ª O)˜ nX+ƒrŸ+o––7>Pyâì®ÁqåA°€}5žWÓIRû”í`T½+ѱf2¹ãóŒßmD$t=wubbgÙA ÿPËyX  -¾t\ÇÇ2¤ úc1¥Ö²€…A(÷zÒ³¶Z½IWƒ[|Êç”L š•X³»ÌÙÕ2L­WEԒŠrÝÁïyñ Žàl @@‰^³íŠm -Ñ*C‘VKë â\”ó'"\ˆ‹ϵg˹&!1!(TؼøD{ñ±º2ÜyÅrLäî3/PÕº}¾ˆ{ô7Ÿ@OáÛV\ظ©Ä7+t@áû ¼šÒzn5«µð"|eâRHnš².Ømª•Èž‚d5Uñ¸>•Ê Y›¥áÛÂrójhT‰ŒLhÚQÕ]­“2èSêeVËr–×nN¼½RVWwáe£ôâO•µø¶RÏvاÖ8ðÉ%ú¥n㊿I$‡6ó©Âj¹eT®”®y†ö!AÖräek$ªQòûû³¢~‡Ô·Cš5hKmUKaì+¶½/zՀáӒxà²xóä:šD7›mN¡ö˾®÷ù¶"'ˆMQ&ÿU+©^ -#­ûC›îc¥òdnÒ*É¢ç8uÌB™¾¹ÈΖ׎mÝÍ'Žâ.1_Ocðžlè£ûJï"^m”gÐI Å öL1+dõ¾ÔUn¹òiömÆNjÂOª„ -1Û ‚† £R¥bàÉTË(ÝðلX+öÇjN`$~õ(„7±¤É»ÿüÛLõ®f -îFâ5hÉÛLûlVËUnË@n -šŸÂ¨õš¯^j@“kV}´ŒŒ„ÑÚÛpٖخ<þÈÆúª‡øÃÂW5÷ЬҎad(µ-}É©ü¢æAá™âËØðœ66µŸå×-?7¯1¶n´Õx -3ÃÁúޑÿ]w·âșNÛ'%§"šÚ8•±á‘­hë fl Ÿ£S7ùÓ¢LZhîDëë¸ÉŽTï&—£ÍË°¦’ÁÖ “öI´}I°9à(EM ?u™ôä!ŋ¬&ÚóNšSh›‡LQÀlÞá$ñK Ü;ÉçNÓÃ*`=lC_Âó*LuÞ=1"DÃâhbhèy¤m‚t{Xz>°m”°ˆ»½éYHøÈ“(žj˜6YL!B(ý.(½!lCùeƒšÌ¶Ís’;···½å½8”Ü ØEb­ÂñJ3¤)…)eˑO’Åp3§JX.A^.'u¥°×û‘Ó¦„)§Öº YÙ§³l“M›ÜxY©ÊY‹áGf¶u·œO:ñkòg¦d³¦ -’«&µQ}´’5÷Ç6ãøÜr¦™-™>±ÒòP=)'E¶Sçå¤hÖ"€ÏtÚ<{²ôô/¡×f©¥{·POo õŸŠiÓ¿)'-®,êMºKtÁcðèTa^œ¾ØòL㨓oД%T=:KÈöÍ.H–ÂÔ8ŠgžÅk Íz®ê$mhMÝC -sº4}…½U‡)4»fÌ÷pãÓ3=Ag¹|ʼÈh-‘š×Q|lŸî•Ó¼ÂšÆdŠ-78Ÿ)ä–&8bââîRéÂ5O͕æÔ¤L¯ßÆ9¢¸©ýƒžiöwÙWEAôÉ6V[‡{œqnÃø\ÛS™ýëF|³Êx:â7Öõt§\IQôjÑÿäâÈÛ -û1ëqgîlIzé0¡±Ô»iJ‰mw?J>²H÷£÷›qZqyÏ¢®C†%1Ü¥ø\-ÿ”q`6tÅýgïÓ“ü¥‰Ðù´‡úd;¶”b‰É“3ªt%žDôöâ)CY'ò2‡Bãy¦P!¨ü=6_º -Rž ê˜y¹}0e@MnÓ`Ò—E_Þ%ÒS´q騑i7•§ÝÖªègLQ -üãƒ)ê6§9Š›ÖÛòå³ ¦(*ž ¦f¶ØXVԝr=mSØôNò¤Ý”cKɾª{|%c«ßª•ð5.^æ>X|™‹/U-mazy -·mµL5wÛ¬RAñLK1¿4O؇êEe£¿ÔÝóMÆX8ªé¡Ê×Üõ:ºæ‡B²Î¹F긝ÓÈ/Zx³^‹ï•À÷[à®øn -ÀÅ|‡í{O&ÿgï wہ8þ*Ó>oU q’~éSìÖH*mª”*Óöö;¸8#æÿ›:ŽÑ/i)8ÃÝ/¡-£ãýí°ßI’P8Z_Þ?îÐyóåó_oD´J©ô¶ú¯+=ݕ¼«‡­ÏkïE’:Átóªí y¥ß}ÞUs”åµ'¹b}jÞGùôyåó<¯˜8Ǽ›õ1¯ÈƒržjK^³’Yãòn[}»m3'¹f­m[mZºyô^ÆËÕ>[=¶m‹òªg¤Ëk5oc˜z ç³j74îS]̺êÊ[+ü&\ÞçεòœŒó¼ÏÞÝþðëYЎÃËk²e¼|?üôWjúãm/ª>¼Þ½¼í²‘¸ð(ºåÌÿïØ+®©¾ ì{ï×r<ÚÈ -¯Ø83k´–{³^I—hE\ÒùJD%ÉDüÊ›p£c#µiä9ÿÈHy™¡Ú ƒÇíRþÝy÷©ÿú§'ñ¡ÿí˟ÚÀ.ŸÔFwÉ_'gːä>®WZ&ÐéŽ}4S~–ç·Eþ§×¸È/çãÒ„[ö^]¤Ï7?>0Á:~IŠÕ6´.Ù ™*Åj¹+Äç~pK¦nü̜[$Ô*n_è—sƨ“ºáN†¼J±Ã´ÑX N4Òé¡påcU>VåcU>VåcU>VåcU>Våc -âcSË߃€tê†WÙY•5?^r,‰;öºY¹Z•«U¹Z•«5/®XØüE7HNü+s«2·*s«2·*skþÌ-°’{ß îý!€I›sɀGã4*pX¨p?Âo?EwèeÓb@^q£Â¸¿ŠõëºÚûAtv·u]äP´¿g÷ `@ïÒÓŠ°3Œ„»,ôǯ&Éú‚l.‹ŠÓÙóŁc@w<+„‰VÙðIf4b¤^<&•Å -KL(n^EŒ„ó⇝¼sÓÿKàÎ@ón!$4k¼ˆ½^(4 AƇ”ðîË ýVû⦅(ÞlD(ž‰ê%Èv— ŠÅ’rсÄ|24Nsv 6 ;^ÜL ;6¤ -ԖBàd7GRœ~ ÑVq³Â0Ù ހ‚™Pۜ†RŠ—¿hJ¬nD(8xÞ(”¤g} Do Òq -è,ü}ԔGÕNšړ)rËWÐ6Ì -,ŽÂIô&of™ ]Ò Å°+Àë€úd>†\Ý €í@…Å”Ó`îb•Ü -ÒS&(λ, h ¾,0iÀ1éz%Нäe ÇÑAfÄ^RÙ)ÄhX=P'90HÆEýsÐbP‚<þ‚'Áýh𳲀ÁŽG÷ -›NJ:é·Â=MëAA&Ó,GE%ÈÔÈ“¤?¹CΉV+Àµr“ÂĂËp–±¬bnB® P›nIæ2ë‚bÛë -øÁX}Å1ƒôœ™tG9qù:”Bв'éÌüBPÃx„Çi`† äÔ²ƒW~q -Á{Ñî&HÈq³ä’kR¶Ð Ãþ%Èì+q‰Yˆyzp 4¯rjP‚LPÝK’ -}-Š€Œ@$ä¹ÐÊøÄÛ¦Ù}¸@fñ]Õ< Ž EøeÊ&ñވñ—íºbþåĬG :ž±V|:Ê(±¨´=K$$PÔ[ᇏ -‹• ÝÖ¬"¿Á²K^ƨÊ¢-‚Û®b‘ØÞSg2ÿB—’Û²HløíÈC_lÒ—À“Ãv(±9χãïî¼cS-bÅ%×@\ýñ‰‰M:°¾êÝcÅ}×NÒC³ž5cäv‚%±h¾ÔÂÃ,l’{07AIuÂJÿ¿•À¶–ó9·rUõ¯³3Êm†Áð]z€ --i€aÚ{Ý목SÕ¤íüûÿØI!!h”§ª±ìÄ¡!ö×­|NÓ(ò -®'|sJ…\aB6 òö?gÜ<ﯔB ÊaF¬,Éê¹e€î<3€;3'³q C![qóPœ“ö h@œ%6mKk@ -GPçŸ Ë>ŒÒJÃbnҌYUã[D·n)Ìútð²Ûõº[A†šZ™•¹nM+Ýã´'¹n¦°kìr¯œdÌ5_V妏™Öä—4ÝO¶Tb¤H¶|»ü`±ŸÀþ»\翽2Ò&*ƒP7ô_ÇSwí¹ŠL:Å{|¼ +ˆ{¦ßàIrü>+1q'5vg2Q^Œ¢8Hø -ì—ó€É¬5‡Þýö¼·|ˆ®ÕËáx¢Æ„eñëbá/$ø1ŽÞ83®f!Znï ”lõÎp‰Ô5ñë‚?¢½Ewd½QuøôIÈ㵃žAâÁ”·x_VWp gïˆ0=uA‚«¸³ØI㶛ò}Öb+8{^¯Ù1® -BODY; - - private Project $project; - - protected function setUp(): void - { - parent::setUp(); - - $this->project = $this->createProject('default'); - } - - public function testSend(): void - { - $this->makeRequest(project: $this->project->getKey())->assertOk(); - - $this->markTestIncomplete('This test has not been implemented yet.'); - } - - private function makeRequest(string $secret = 'secret', string|Key $project = 'default'): ResponseAssertions - { - return $this->http - ->postJson( - uri: '/api/' . $project . '/envelope/?sentry_key=' . $secret . '&sentry_version=7&sentry_client=sentry.javascript.vue%2F8.9.2', - data: Stream::create(self::JSON), - headers: [ - 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36', - ], - ); - } -} +ddÅ%[vWoé’Å«W$:’¤3Oãívš$èÿ€Cú–¤˜lÐóºÇ,6[ÑvHè+¶ÛÇِ7b"g’o¾ Ãé*6YãŽ$¼ígzb M¯£ý!ÕH«Öˆ¦·,¾ùŽ¦$ Éû8Ĉ5 “üá+²O1ý–­ªÁÉgoé`Fþ@ɊÆÕçÉœ¢å9ãýœ½[¡A=€—Û \ý„VŒÓ*6Ed‡ ¨Â.äR8,Â`ùbèà.¹ORºSwþû…É ß +ÃIšÆÁâòI>vBqÓ¨µ©¿d•a´¸Ï+“/·$N($Ùyÿó÷ÂoA# AaÝT`ÆñïÒ2:ƒý£AY‡h±L2¶LR‹¸È1 ·{§x¾dQJ#>‡˜ý劃%uÅM× ¢ +Hè&0búÒë +lXL,X¤AÒ¶Œb$ ä•Fék¼üI™=ÈÙà*jgKÒûêl²£Ý_&ÜpEvAJ]ërˆ~ÌXڏéž%}²ß'ýぺû˜} Ë´ŸÄË>I ñ¤¿#AÔãPZ1琝ŽëSwéÞn1ïÜùb-^/ +ÍnÂÖ)6å?¥g;ÐßùüG?[„dyƒfoÊŠÍ +œ/^¥gœ?å?úY­‚ +ãíË! +tû*8ð nÈÒõæN¼YçãA×Qƒž?ûÊÒ߯íïùÕþ+ßhðÓ«®£þ½ñÈÒ]A/v¿šæݹ@rԏ$~^ ·¶c=Îãq©³BØ*ÄU×Mô‡£®“¿êº?䊲d!‹ÝÄ´‰Ù!ZYÀ—»Iy—ûŠæú™Tðfsb% ýJò­tv·ìØ8Ä3†pçD›BoSdFWÞÜÜ/Á"tº²Ÿ;Þž¬ý׎cç9ëÑMK–[ºý\8_9¯#Çi)aB-e›bKäöÙN™n#‚LiÛH Ò³^…‡ëèáë®3Ÿ/èšÅ”_‘uJc°tÁîÜ$øŸ˜Fbˆ¦Ύě š;BRk¸M÷V„½¹±xGB]°Õ= 삘fϼÁà¸}á¤>9†À¤*¹2çÑ)I” Ä1Ì/ÃG‰CIBAÒ5€d£ _8ä4Ǩ7–ø¯É.ïçÎk„€¸ë¸ˆ'!¬P$<]ç[þ$Ëwâþ{ è:םwtèóþõu§ë¼e –²®óæî~C£®ó~qˆÒC×A¾š’˜†!ð}çÐç#®;ßÅ,X÷?ÐðHÓ`IœŸèò¶Ï`q€ #Є0 xވó]H1¦¤"Äs瞇t,‚0Hï¡·tq€<1xCي¾À +9B¦¬ «/@-—¹Ë’ÌàO…l +A;䐲Ξ¬2µócº³ ŸtÞ&¦4ÔLÙxòN2¡E,¢Z à\ŸÃK{ÓÞ|î©Mù’0äaÁŸž~XpÒnÄ?éÈ\Üq-.i„téÆ´"JSP ¹æ*n ü«ý„+{$û@cÖ!&¸F +G¼K –È"h,À9Žd®î¿‰ðœ¿Cí±BÁú„£uØEé­cþgÐÉ9Ÿ±š#dzªäH™är€gBž§²,oð'¤YK¬~ Ó©T8d¿°8\õÐëŸø{Æçx)¦†ÐMï^ž%K¶§«—Ô›P2›xÏøÂà¼mëýšaê* ¿Çe + +Fã÷Ƃ CjÌ*y„2¦ Çõ²À³ZaKóëIO!¦Ä©AHڀ|^ TØìpÃ}™RšS +ø¤³†t6ªÖP«–m­wIÕúf¿o¡H2!ÃÉâQŠ$ÖΊK +çR)PŒ¸3¼+Dz‡^È6¬n¸¶w±·Põ¤Ê¨#r¬®?ø²èú}íúKz“Mà +UÎa;¤χH¸¢—Þ‘%F"Ý:Òºií±ù\` +ÞWxø=¢bÄUOÀmä` YHF<£'•© ×epÍ Y )„è¢é¨¢»â$uÙÚåŠ"RŸ,y+&£6›´«Q›8!IrãL·°p_>ϐ72㯜¾#c|€MíL5ãZ .2r<Þm s;aÞäb/†àÄ5‡3wø»œÀ¢ÎU—#Õ5“™›ÉÑÔóÌW+Yóی SͳN +Îk¤—±ùgÄÅ_hˆ;úlláÏ«Ùb¸ŽáÏz\RJ +N®¦{( º&.>ôVbÿ2©ƒÈ‡Aøá>ª O)˜ nX+ƒrŸ+o––7>Pyâì®ÁqåA°€}5žWÓIRû”í`T½+ѱf2¹ãóŒßmD$t=wubbgÙA ÿPËyX  +¾t\ÇÇ2¤ úc1¥Ö²€…A(÷zÒ³¶Z½IWƒ[|Êç”L š•X³»ÌÙÕ2L­WEԒŠrÝÁïyñ Žàl @@‰^³íŠm +Ñ*C‘VKë â\”ó'"\ˆ‹ϵg˹&!1!(TؼøD{ñ±º2ÜyÅrLäî3/PÕº}¾ˆ{ô7Ÿ@OáÛV\ظ©Ä7+t@áû ¼šÒzn5«µð"|eâRHnš².Ømª•Èž‚d5Uñ¸>•Ê Y›¥áÛÂrójhT‰ŒLhÚQÕ]­“2èSêeVËr–×nN¼½RVWwáe£ôâO•µø¶RÏvاÖ8ðÉ%ú¥n㊿I$‡6ó©Âj¹eT®”®y†ö!AÖräek$ªQòûû³¢~‡Ô·Cš5hKmUKaì+¶½/zՀáӒxà²xóä:šD7›mN¡ö˾®÷ù¶"'ˆMQ&ÿU+©^ +#­ûC›îc¥òdnÒ*É¢ç8uÌB™¾¹ÈΖ׎mÝÍ'Žâ.1_Ocðžlè£ûJï"^m”gÐI Å öL1+dõ¾ÔUn¹òiömÆNjÂOª„ +1Û ‚† £R¥bàÉTË(ÝðلX+öÇjN`$~õ(„7±¤É»ÿüÛLõ®f +îFâ5hÉÛLûlVËUnË@n +šŸÂ¨õš¯^j@“kV}´ŒŒ„ÑÚÛpٖخ<þÈÆúª‡øÃÂW5÷ЬҎad(µ-}É©ü¢æAá™âËØðœ66µŸå×-?7¯1¶n´Õx +3ÃÁúޑÿ]w·âșNÛ'%§"šÚ8•±á‘­hë fl Ÿ£S7ùÓ¢LZhîDëë¸ÉŽTï&—£ÍË°¦’ÁÖ “öI´}I°9à(EM ?u™ôä!ŋ¬&ÚóNšSh›‡LQÀlÞá$ñK Ü;ÉçNÓÃ*`=lC_Âó*LuÞ=1"DÃâhbhèy¤m‚t{Xz>°m”°ˆ»½éYHøÈ“(žj˜6YL!B(ý.(½!lCùeƒšÌ¶Ís’;···½å½8”Ü ØEb­ÂñJ3¤)…)eˑO’Åp3§JX.A^.'u¥°×û‘Ó¦„)§Öº YÙ§³l“M›ÜxY©ÊY‹áGf¶u·œO:ñkòg¦d³¦ +’«&µQ}´’5÷Ç6ãøÜr¦™-™>±ÒòP=)'E¶Sçå¤hÖ"€ÏtÚ<{²ôô/¡×f©¥{·POo õŸŠiÓ¿)'-®,êMºKtÁcðèTa^œ¾ØòL㨓oД%T=:KÈöÍ.H–ÂÔ8ŠgžÅk Íz®ê$mhMÝC +sº4}…½U‡)4»fÌ÷pãÓ3=Ag¹|ʼÈh-‘š×Q|lŸî•Ó¼ÂšÆdŠ-78Ÿ)ä–&8bââîRéÂ5O͕æÔ¤L¯ßÆ9¢¸©ýƒžiöwÙWEAôÉ6V[‡{œqnÃø\ÛS™ýëF|³Êx:â7Öõt§\IQôjÑÿäâÈÛ +û1ëqgîlIzé0¡±Ô»iJ‰mw?J>²H÷£÷›qZqyÏ¢®C†%1Ü¥ø\-ÿ”q`6tÅýgïÓ“ü¥‰Ðù´‡úd;¶”b‰É“3ªt%žDôöâ)CY'ò2‡Bãy¦P!¨ü=6_º +Rž ê˜y¹}0e@MnÓ`Ò—E_Þ%ÒS´q騑i7•§ÝÖªègLQ +üãƒ)ê6§9Š›ÖÛòå³ ¦(*ž ¦f¶ØXVԝr=mSØôNò¤Ý”cKɾª{|%c«ßª•ð5.^æ>X|™‹/U-mazy +·mµL5wÛ¬RAñLK1¿4O؇êEe£¿ÔÝóMÆX8ªé¡Ê×Üõ:ºæ‡B²Î¹F긝ÓÈ/Zx³^‹ï•À÷[à®øn +ÀÅ|‡í{O&ÿgï wہ8þ*Ó>oU q’~éSìÖH*mª”*Óöö;¸8#æÿ›:ŽÑ/i)8ÃÝ/¡-£ãýí°ßI’P8Z_Þ?îÐyóåó_oD´J©ô¶ú¯+=ݕ¼«‡­ÏkïE’:Átóªí y¥ß}ÞUs”åµ'¹b}jÞGùôyåó<¯˜8Ǽ›õ1¯ÈƒržjK^³’Yãòn[}»m3'¹f­m[mZºyô^ÆËÕ>[=¶m‹òªg¤Ëk5oc˜z ç³j74îS]̺êÊ[+ü&\ÞçεòœŒó¼ÏÞÝþðëYЎÃËk²e¼|?üôWjúãm/ª>¼Þ½¼í²‘¸ð(ºåÌÿïØ+®©¾ ì{ï×r<ÚÈ +¯Ø83k´–{³^I—hE\ÒùJD%ÉDüÊ›p£c#µiä9ÿÈHy™¡Ú ƒÇíRþÝy÷©ÿú§'ñ¡ÿí˟ÚÀ.ŸÔFwÉ_'gːä>®WZ&ÐéŽ}4S~–ç·Eþ§×¸È/çãÒ„[ö^]¤Ï7?>0Á:~IŠÕ6´.Ù ™*Åj¹+Äç~pK¦nü̜[$Ô*n_è—sƨ“ºáN†¼J±Ã´ÑX N4Òé¡påcU>VåcU>VåcU>VåcU>Våc +âcSË߃€tê†WÙY•5?^r,‰;öºY¹Z•«U¹Z•«5/®XØüE7HNü+s«2·*s«2·*skþÌ-°’{ß îý!€I›sɀGã4*pX¨p?Âo?EwèeÓb@^q£Â¸¿ŠõëºÚûAtv·u]äP´¿g÷ `@ïÒÓŠ°3Œ„»,ôǯ&Éú‚l.‹ŠÓÙóŁc@w<+„‰VÙðIf4b¤^<&•Å +KL(n^EŒ„ó⇝¼sÓÿKàÎ@ón!$4k¼ˆ½^(4 AƇ”ðîË ýVû⦅(ÞlD(ž‰ê%Èv— ŠÅ’rсÄ|24Nsv 6 ;^ÜL ;6¤ +ԖBàd7GRœ~ ÑVq³Â0Ù ހ‚™Pۜ†RŠ—¿hJ¬nD(8xÞ(”¤g} Do Òq +è,ü}ԔGÕNšړ)rËWÐ6Ì +,ŽÂIô&of™ ]Ò Å°+Àë€úd>†\Ý €í@…Å”Ó`îb•Ü +ÒS&(λ, h ¾,0iÀ1éz%Нäe ÇÑAfÄ^RÙ)ÄhX=P'90HÆEýsÐbP‚<þ‚'Áýh𳲀ÁŽG÷ +›NJ:é·Â=MëAA&Ó,GE%ÈÔÈ“¤?¹CΉV+Àµr“ÂĂËp–±¬bnB® P›nIæ2ë‚bÛë +øÁX}Å1ƒôœ™tG9qù:”Bв'éÌüBPÃx„Çi`† äÔ²ƒW~q +Á{Ñî&HÈq³ä’kR¶Ð Ãþ%Èì+q‰Yˆyzp 4¯rjP‚LPÝK’ +}-Š€Œ@$ä¹ÐÊøÄÛ¦Ù}¸@fñ]Õ< Ž EøeÊ&ñވñ—íºbþåĬG :ž±V|:Ê(±¨´=K$$PÔ[ᇏ +‹• ÝÖ¬"¿Á²K^ƨÊ¢-‚Û®b‘ØÞSg2ÿB—’Û²HløíÈC_lÒ—À“Ãv(±9χãïî¼cS-bÅ%×@\ýñ‰‰M:°¾êÝcÅ}×NÒC³ž5cäv‚%±h¾ÔÂÃ,l’{07AIuÂJÿ¿•À¶–ó9·rUõ¯³3Êm†Áð]z€ +-i€aÚ{Ý목SÕ¤íüûÿØI!!h”§ª±ìÄ¡!ö×­|NÓ(ò +®'|sJ…\aB6 òö?gÜ<ﯔB ÊaF¬,Éê¹e€î<3€;3'³q C![qóPœ“ö h@œ%6mKk@ +GPçŸ Ë>ŒÒJÃbnҌYUã[D·n)Ìútð²Ûõº[A†šZ™•¹nM+Ýã´'¹n¦°kìr¯œdÌ5_V妏™Öä—4ÝO¶Tb¤H¶|»ü`±ŸÀþ»\翽2Ò&*ƒP7ô_ÇSwí¹ŠL:Å{|¼ +ˆ{¦ßàIrü>+1q'5vg2Q^Œ¢8Hø +ì—ó€É¬5‡Þýö¼·|ˆ®ÕËáx¢Æ„eñëbá/$ø1ŽÞ83®f!Znï ”lõÎp‰Ô5ñë‚?¢½Ewd½QuøôIÈ㵃žAâÁ”·x_VWp gïˆ0=uA‚«¸³ØI㶛ò}Öb+8{^¯Ù1® +BODY; + + private Project $project; + + protected function setUp(): void + { + parent::setUp(); + + $this->project = $this->createProject('foo'); + } + + public function testSend(): void + { + $this->makeRequest(project: $this->project->getKey())->assertOk(); + + $this->markTestIncomplete('This test has not been implemented yet.'); + } + + private function makeRequest(string $secret = 'secret', string|Key $project = 'foo'): ResponseAssertions + { + return $this->http + ->postJson( + uri: '/api/' . $project . '/envelope/?sentry_key=' . $secret . '&sentry_version=7&sentry_client=sentry.javascript.vue%2F8.9.2', + data: Stream::create(self::JSON), + headers: [ + 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36', + ], + ); + } +} diff --git a/tests/Feature/Interfaces/Http/Sentry/SentryVueTransactionActionTest.php b/tests/Feature/Interfaces/Http/Sentry/SentryVueTransactionActionTest.php index 75a54dc3..05c4c110 100644 --- a/tests/Feature/Interfaces/Http/Sentry/SentryVueTransactionActionTest.php +++ b/tests/Feature/Interfaces/Http/Sentry/SentryVueTransactionActionTest.php @@ -24,7 +24,7 @@ protected function setUp(): void { parent::setUp(); - $this->project = $this->createProject('default'); + $this->project = $this->createProject('foo'); } public function testSend(): void @@ -34,7 +34,7 @@ public function testSend(): void $this->markTestIncomplete('This test has not been implemented yet.'); } - private function makeRequest(string $secret = 'secret', string|Key $project = 'default'): ResponseAssertions + private function makeRequest(string $secret = 'secret', string|Key $project = 'foo'): ResponseAssertions { return $this->http ->postJson(