-<?php namespace Tests;
+<?php
+
+namespace Tests;
use BookStack\Notifications\TestEmail;
use Illuminate\Contracts\Notifications\Dispatcher;
class TestEmailTest extends TestCase
{
-
public function test_a_send_test_button_shows()
{
$pageView = $this->asAdmin()->get('/settings/maintenance');
$formCssSelector = 'form[action$="/settings/maintenance/send-test-email"]';
- $pageView->assertElementExists($formCssSelector);
- $pageView->assertElementContains($formCssSelector . ' button', 'Send Test Email');
+ $this->withHtml($pageView)->assertElementExists($formCssSelector);
+ $this->withHtml($pageView)->assertElementContains($formCssSelector . ' button', 'Send Test Email');
}
public function test_send_test_email_endpoint_sends_email_and_redirects_user_and_shows_notification()
$this->app[Dispatcher::class] = $mockDispatcher;
$exception = new \Exception('A random error occurred when testing an email');
- $mockDispatcher->shouldReceive('send')->andThrow($exception);
+ $mockDispatcher->shouldReceive('sendNow')->andThrow($exception);
$admin = $this->getAdmin();
$sendReq = $this->actingAs($admin)->post('/settings/maintenance/send-test-email');
$sendReq = $this->actingAs($user)->post('/settings/maintenance/send-test-email');
Notification::assertSentTo($user, TestEmail::class);
}
-
-
-}
\ No newline at end of file
+}