Skip to content
Merged
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
49 changes: 33 additions & 16 deletions tests/Functional/NotifierCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,79 @@
namespace App\Tests\Functional;

use App\Tests\Support\FunctionalTester;
use PHPUnit\Framework\AssertionFailedError;

final class NotifierCest
{
public function assertNotificationSubjectContains(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
$notification = $I->getNotifierMessage();
$I->assertNotificationSubjectContains($notification, 'created!');
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
$notification = $I->getNotifierMessage();
$I->assertNotificationSubjectContains($notification, 'created!');
});
}

public function assertNotificationSubjectNotContains(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
$notification = $I->getNotifierMessage();
$I->assertNotificationSubjectNotContains($notification, 'Account not created!');
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
$notification = $I->getNotifierMessage();
$I->assertNotificationSubjectNotContains($notification, 'Account not created!');
});
}

public function assertNotificationTransportIsEqual(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
$notification = $I->getNotifierMessage();
$I->assertNotificationTransportIsEqual($notification);
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
$notification = $I->getNotifierMessage();
$I->assertNotificationTransportIsEqual($notification);
});
}

public function assertNotificationTransportIsNotEqual(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
$notification = $I->getNotifierMessage();
$I->assertNotificationTransportIsNotEqual($notification, 'chat');
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
$notification = $I->getNotifierMessage();
$I->assertNotificationTransportIsNotEqual($notification, 'chat');
});
}

public function dontSeeNotificationIsSent(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
// There is already an account with this notification
$I->dontSeeNotificationIsSent();
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
// There is already an account with this notification
$I->dontSeeNotificationIsSent();
});
}

public function grabLastSentNotification(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
$notification = $I->grabLastSentNotification();
$I->assertSame('Account created!', $notification->getSubject());
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
$notification = $I->grabLastSentNotification();
$I->assertSame('Account created!', $notification->getSubject());
});
}

public function grabSentNotifications(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
$notifications = $I->grabSentNotifications();
$subject = $notifications[0]->getSubject();
$I->assertSame('Account created!', $subject);
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
$notifications = $I->grabSentNotifications();
$subject = $notifications[0]->getSubject();
$I->assertSame('Account created!', $subject);
});
}

public function seeNotificationIsSent(FunctionalTester $I)
{
$I->registerUser('[email protected]', '123456', followRedirects: false);
$I->seeNotificationIsSent();
$I->expectThrowable(AssertionFailedError::class, function () use ($I) {
$I->seeNotificationIsSent();
});
}
}
Loading