From a6badbb0fb8788d7ddb6659912858a298ab91008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Ga=C5=A1pari=C4=87?= Date: Tue, 14 May 2024 16:08:02 +0200 Subject: [PATCH] Vsliv update stomp version (#29) * Apply fixes from StyleCI * update laravel-stomp version --------- Co-authored-by: StyleCI Bot --- composer.json | 2 +- composer.lock | 14 +++++++------- config/asseco-broadcaster.php | 12 ++++++------ src/App/Events/AbstractModelAction.php | 6 +++--- src/App/Events/ModelDeleted.php | 8 ++++---- src/Changes.php | 8 ++++---- tests/Unit/ChangesTest.php | 8 ++++---- tests/Unit/ModelActionTest.php | 24 ++++++++++++------------ 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/composer.json b/composer.json index 4a36ba7..5bdf286 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "require": { "php": "^8.1", "laravel/framework": "^10.0", - "asseco-voice/laravel-stomp": "^3.0" + "asseco-voice/laravel-stomp": "^4.0" }, "require-dev": { "phpunit/phpunit": "^10.0", diff --git a/composer.lock b/composer.lock index 5e6c5fd..9e3163a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "39c8dae6f98840a2c891d658714fa690", + "content-hash": "3314515824cc0bfdbe497a3a4038b86c", "packages": [ { "name": "asseco-voice/laravel-stomp", - "version": "v3.0.0", + "version": "v4.0.0", "source": { "type": "git", "url": "https://github.com/asseco-voice/laravel-stomp.git", - "reference": "9b2c0f8349a2daa1e11e15b3199c00effd128033" + "reference": "d7ec135b558f8b25494e3e1a59a29adfffe107d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/asseco-voice/laravel-stomp/zipball/9b2c0f8349a2daa1e11e15b3199c00effd128033", - "reference": "9b2c0f8349a2daa1e11e15b3199c00effd128033", + "url": "https://api.github.com/repos/asseco-voice/laravel-stomp/zipball/d7ec135b558f8b25494e3e1a59a29adfffe107d4", + "reference": "d7ec135b558f8b25494e3e1a59a29adfffe107d4", "shasum": "" }, "require": { @@ -59,9 +59,9 @@ ], "support": { "issues": "https://github.com/asseco-voice/laravel-stomp/issues", - "source": "https://github.com/asseco-voice/laravel-stomp/tree/v3.0.0" + "source": "https://github.com/asseco-voice/laravel-stomp/tree/v4.0.0" }, - "time": "2023-08-08T08:15:03+00:00" + "time": "2024-05-14T13:29:51+00:00" }, { "name": "brick/math", diff --git a/config/asseco-broadcaster.php b/config/asseco-broadcaster.php index 94db76c..e3e8b45 100644 --- a/config/asseco-broadcaster.php +++ b/config/asseco-broadcaster.php @@ -11,27 +11,27 @@ * Registered events. */ 'dispatches_events' => [ - 'created' => ModelCreated::class, - 'deleted' => ModelDeleted::class, + 'created' => ModelCreated::class, + 'deleted' => ModelDeleted::class, 'restored' => ModelRestored::class, // 'retrieved' => ModelRetrieved::class, - 'updated' => ModelUpdated::class, + 'updated' => ModelUpdated::class, ], /** * Queue on which the events will be broadcast to. */ - 'broadcast_queue' => 'eloquent', + 'broadcast_queue' => 'eloquent', /** * Disable if you don't want to have old/new attribute values propagated. */ - 'with_changes' => true, + 'with_changes' => true, /** * Channels to broadcast the events on. */ - 'broadcast_on' => [], + 'broadcast_on' => [], 'enable_logs' => env('BROADCASTER_LOGS', false) === true, diff --git a/src/App/Events/AbstractModelAction.php b/src/App/Events/AbstractModelAction.php index 472391d..e792a26 100644 --- a/src/App/Events/AbstractModelAction.php +++ b/src/App/Events/AbstractModelAction.php @@ -91,8 +91,8 @@ public function getHeaders(): array { $headers = [ 'service' => $this->getServiceName(), - 'model' => $this->getModelName(), - 'action' => $this->getActionName(), + 'model' => $this->getModelName(), + 'action' => $this->getActionName(), ]; if ($this->model instanceof AppendsHeaders) { @@ -107,7 +107,7 @@ public function getRawData(): array $payload = array_merge($this->model->toArray(), $this->appendAdditionalData()); $rawData = [ - 'uuid' => Str::uuid(), + 'uuid' => Str::uuid(), 'payload' => $payload, ]; diff --git a/src/App/Events/ModelDeleted.php b/src/App/Events/ModelDeleted.php index ba81c17..548ba67 100644 --- a/src/App/Events/ModelDeleted.php +++ b/src/App/Events/ModelDeleted.php @@ -39,14 +39,14 @@ protected function setSoftDeleteFields(): array $data = $this->model->toArray(); $old = [ - 'deleted_at' => null, - 'deleted_by' => null, + 'deleted_at' => null, + 'deleted_by' => null, 'deleter_type' => null, ]; $new = [ - 'deleted_at' => Arr::get($data, 'deleted_at'), - 'deleted_by' => Arr::get($data, 'deleted_by'), + 'deleted_at' => Arr::get($data, 'deleted_at'), + 'deleted_by' => Arr::get($data, 'deleted_by'), 'deleter_type' => Arr::get($data, 'deleter_type'), ]; diff --git a/src/Changes.php b/src/Changes.php index 5f277b9..8159cf4 100644 --- a/src/Changes.php +++ b/src/Changes.php @@ -26,11 +26,11 @@ public function __construct($modelId, string $actionPerformerType, string $actio public function generate(): array { return [self::CHANGES => [ - 'id' => $this->modelId, + 'id' => $this->modelId, 'action_performer_type' => $this->actionPerformerType, - 'action_performer_id' => $this->actionPerformerId, - 'old' => $this->old, - 'new' => $this->new, + 'action_performer_id' => $this->actionPerformerId, + 'old' => $this->old, + 'new' => $this->new, ]]; } } diff --git a/tests/Unit/ChangesTest.php b/tests/Unit/ChangesTest.php index 5a4ad9b..d56a060 100644 --- a/tests/Unit/ChangesTest.php +++ b/tests/Unit/ChangesTest.php @@ -15,11 +15,11 @@ public function returns_changes_array() $changes = new Changes(1, 'user', '1', [], []); $expected = ['_changes' => [ - 'id' => 1, + 'id' => 1, 'action_performer_type' => 'user', - 'action_performer_id' => '1', - 'old' => [], - 'new' => [], + 'action_performer_id' => '1', + 'old' => [], + 'new' => [], ]]; $this->assertEquals($expected, $changes->generate()); diff --git a/tests/Unit/ModelActionTest.php b/tests/Unit/ModelActionTest.php index 5bd6e32..a1b132c 100644 --- a/tests/Unit/ModelActionTest.php +++ b/tests/Unit/ModelActionTest.php @@ -29,8 +29,8 @@ public function it_has_headers() $expected = [ 'service' => 'laravel', - 'model' => get_class($testModel), - 'action' => 'test', + 'model' => get_class($testModel), + 'action' => 'test', ]; $this->assertEquals($expected, $modelEvent->getHeaders()); @@ -47,8 +47,8 @@ public function it_has_plain_model_headers() $expected = [ 'service' => 'laravel', - 'model' => 'mockery_0__illuminate__database__eloquent__model', - 'action' => 'test', + 'model' => 'mockery_0__illuminate__database__eloquent__model', + 'action' => 'test', ]; $this->assertEquals($expected, $modelEvent->getHeaders()); @@ -66,9 +66,9 @@ public function it_has_appended_headers() $modelEvent = new TestEvent($testModel); $expected = [ - 'service' => 'laravel', - 'model' => get_class($testModel), - 'action' => 'test', + 'service' => 'laravel', + 'model' => get_class($testModel), + 'action' => 'test', 'appended_header' => '123', ]; @@ -112,7 +112,7 @@ public function it_returns_appended_data() $expected = [ 'serialized_model' => '123', - 'appended_data' => '123', + 'appended_data' => '123', ]; $this->assertArrayHasKey('uuid', $modelEvent->getRawData()); @@ -145,11 +145,11 @@ public function it_returns_model_changes() $modelEvent = new TestEvent($testModel); $expected = [ - 'id' => 'id', + 'id' => 'id', 'action_performer_type' => 'unknown', - 'action_performer_id' => 'unknown', - 'old' => ['attribute' => 'test-before'], - 'new' => ['attribute' => 'test-after'], + 'action_performer_id' => 'unknown', + 'old' => ['attribute' => 'test-before'], + 'new' => ['attribute' => 'test-after'], ]; $rawData = $modelEvent->getRawData();