Skip to content

Commit

Permalink
Vsliv update stomp version (#29)
Browse files Browse the repository at this point in the history
* Apply fixes from StyleCI

* update laravel-stomp version

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
  • Loading branch information
ngaspari and StyleCIBot committed May 14, 2024
1 parent 3961292 commit a6badbb
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions config/asseco-broadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
6 changes: 3 additions & 3 deletions src/App/Events/AbstractModelAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
];

Expand Down
8 changes: 4 additions & 4 deletions src/App/Events/ModelDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
];

Expand Down
8 changes: 4 additions & 4 deletions src/Changes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]];
}
}
8 changes: 4 additions & 4 deletions tests/Unit/ChangesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
24 changes: 12 additions & 12 deletions tests/Unit/ModelActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand All @@ -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',
];

Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit a6badbb

Please sign in to comment.