Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Nov 20, 2023
1 parent 3422643 commit b3b4fd5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/pest --filter 'can ignore a subscriber'
run: vendor/bin/pest
6 changes: 0 additions & 6 deletions src/Channels/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,9 @@ public function subscribed(Connection $connection): bool
*/
public function broadcast(Application $app, array $payload, Connection $except = null): void
{
dump($except ? $except->identifier() : 'No ID');
dump($this->name());
dump(count($this->connections()));
collect($this->connections())
->each(function ($connection) use ($payload, $except) {
dump($connection->connection()->identifier());
if ($except && $except->identifier() === $connection->connection()->identifier()) {
dump('Returning early');

return;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/Reverb/EventsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@
it('can ignore a subscriber', function () {
$connection = $this->connect();
$this->subscribe('test-channel-two', connection: $connection);

$promiseOne = $this->messagePromise($connection);
$response = await($this->signedPostRequest('events', [
'name' => 'NewEvent',
'channels' => ['test-channel-one', 'test-channel-two'],
'data' => ['some' => 'data'],
]));
expect(await($promiseOne))->toBe('{"event":"NewEvent","data":{"some":"data"},"channel":"test-channel-two"}');


$promiseTwo = $this->messagePromise($connection);
$response = await($this->signedPostRequest('events', [
Expand All @@ -91,6 +92,5 @@

$this->assertSame(200, $response->getStatusCode());
$this->assertSame('{}', $response->getBody()->getContents());
expect(await($promiseOne))->toBe('{"event":"NewEvent","data":{"some":"data"},"channel":"test-channel-two"}');
expect(await($promiseTwo))->toBeFalse();
});

0 comments on commit b3b4fd5

Please sign in to comment.