Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrich authored and Henrich committed Dec 4, 2020
1 parent 5f92531 commit 6ccee49
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
},
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
},
"config": {
"sort-packages": true
Expand Down
4 changes: 2 additions & 2 deletions src/CanTestBroadcasting.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

trait CanTestBroadcasting
{
public function assertEventHasBroadcast($event, $channels = null, $count = null)
public function assertEventWasBroadcast($event, $channels = null, $count = null)
{
$broadcaster = resolve(TestBroadcaster::class);

$message = "Failed asserting that event '$event' was broadcasted";
$message = "Failed asserting that event '$event' was broadcast";

if (is_integer($channels)) {
$count = $channels;
Expand Down
36 changes: 18 additions & 18 deletions tests/CanTestBroadcastingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,71 +12,71 @@ class CanTestBroadcastingTest extends TestCase
public function it_can_assert_when_an_event_is_broadcast()
{
try {
$this->assertEventHasBroadcast(TestEvent::class);
$this->fail("assertEventBroadcasted asserted that an event was broadcasted when it wasn't");
$this->assertEventWasBroadcast(TestEvent::class);
$this->fail("assertEventWasBroadcast asserted that an event was broadcast when it wasn't");
} catch (ExpectationFailedException $e) {
}

event(new TestEvent());

$this->assertEventHasBroadcast(TestEvent::class);
$this->assertEventWasBroadcast(TestEvent::class);
}

/**
* @test
*/
public function it_can_assert_if_an_event_was_broadcasted_a_given_amount_of_times()
public function it_can_assert_if_an_event_was_broadcast_a_given_amount_of_times()
{
try {
$this->assertEventHasBroadcast(TestEvent::class, 1);
$this->fail("assertEventBroadcasted asserted that an event was broadcasted once when it wasn't");
$this->assertEventWasBroadcast(TestEvent::class, 1);
$this->fail("assertEventWasBroadcast asserted that an event was broadcast once when it wasn't");
} catch (ExpectationFailedException $e) {
}

event(new TestEvent());
$this->assertEventHasBroadcast(TestEvent::class, 1);
$this->assertEventWasBroadcast(TestEvent::class, 1);

try {
$this->assertEventHasBroadcast(TestEvent::class, 2);
$this->fail("assertEventBroadcasted asserted that an event was broadcasted twice when only was broadcasted once");
$this->assertEventWasBroadcast(TestEvent::class, 2);
$this->fail("assertEventWasBroadcast asserted that an event was broadcast twice when only was broadcast once");
} catch (ExpectationFailedException $e) {
}

event(new TestEvent());
$this->assertEventHasBroadcast(TestEvent::class, 2);
$this->assertEventWasBroadcast(TestEvent::class, 2);
}

/**
* @test
*/
public function it_can_assert_if_an_event_was_broadcasted_on_a_single_channel()
public function it_can_assert_if_an_event_was_broadcast_on_a_single_channel()
{
event(new TestEvent());

$this->assertEventHasBroadcast(TestEvent::class, 'private-channel-name');
$this->assertEventWasBroadcast(TestEvent::class, 'private-channel-name');

try {
$this->assertEventHasBroadcast(TestEvent::class, 'somethingelse-fake-channel');
$this->fail("assertEventBroadcasted asserted that an event was broadcasted on a given channel when it wasn't");
$this->assertEventWasBroadcast(TestEvent::class, 'somethingelse-fake-channel');
$this->fail("assertEventWasBroadcast asserted that an event was broadcast on a given channel when it wasn't");
} catch (ExpectationFailedException $e) {
}
}

/**
* @test
*/
public function it_can_assert_if_an_event_was_broadcasted_on_multiple_channels()
public function it_can_assert_if_an_event_was_broadcast_on_multiple_channels()
{
event(new TestEvent());

$this->assertEventHasBroadcast(TestEvent::class, ['private-channel-name', 'private-another-channel-name']);
$this->assertEventWasBroadcast(TestEvent::class, ['private-channel-name', 'private-another-channel-name']);

try {
$this->assertEventHasBroadcast(TestEvent::class, [
$this->assertEventWasBroadcast(TestEvent::class, [
'private-channel-name',
'somethingelse-fake-channel',
]);
$this->fail("assertEventBroadcasted asserted that an event was broadcasted on given channels when it wasn't");
$this->fail("assertEventWasBroadcast asserted that an event was broadcast on given channels when it wasn't");
} catch (ExpectationFailedException $e) {
}
}
Expand Down

0 comments on commit 6ccee49

Please sign in to comment.