Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<testsuite name="Datatables">
<directory suffix="Test.php">./tests/Datatables</directory>
</testsuite>
<testsuite name="Helpers">
<directory suffix="Test.php">./tests/Helpers</directory>
</testsuite>
<testsuite name="Menu">
<directory suffix="Test.php">./tests/Menu</directory>
</testsuite>
Expand Down
30 changes: 30 additions & 0 deletions tests/Helpers/ChannelHashTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Sebastienheyd\Boilerplate\Tests\Helpers;

use Sebastienheyd\Boilerplate\Tests\TestCase;

class ChannelHashTest extends TestCase
{
public function testChannelHashGeneratesSignature()
{
$signature = md5('Notifications|1'.config('app.key').config('app.url'));
$expected = 'Notifications.1.'.$signature;

$this->assertEquals($expected, channel_hash('Notifications', 1));
}

public function testChannelHashEqualsSuccess()
{
$signature = md5('Notifications|1'.config('app.key').config('app.url'));

$this->assertTrue(channel_hash_equals($signature, 'Notifications', 1));
}

public function testChannelHashEqualsFailure()
{
$signature = md5('Notifications|2'.config('app.key').config('app.url'));

$this->assertFalse(channel_hash_equals($signature, 'Notifications', 1));
}
}