]> BookStack Code Mirror - bookstack/blob - tests/ErrorTest.php
fix image delete confirm text
[bookstack] / tests / ErrorTest.php
1 <?php namespace Tests;
2
3 use BookStack\Entities\Models\Book;
4 use Illuminate\Support\Facades\Log;
5
6 class ErrorTest extends TestCase
7 {
8
9     public function test_404_page_does_not_show_login()
10     {
11         // Due to middleware being handled differently this will not fail
12         // if our custom, middleware-loaded handler fails but this is here
13         // as a reminder and as a general check in the event of other issues.
14         $editor = $this->getEditor();
15         $editor->name = 'tester';
16         $editor->save();
17
18         $this->actingAs($editor);
19         $notFound = $this->get('/fgfdngldfnotfound');
20         $notFound->assertStatus(404);
21         $notFound->assertDontSeeText('Log in');
22         $notFound->assertSeeText('tester');
23     }
24
25     public function test_item_not_found_does_not_get_logged_to_file()
26     {
27         $this->actingAs($this->getViewer());
28         $handler = $this->withTestLogger();
29         $book = Book::query()->first();
30
31         // Ensure we're seeing errors
32         Log::error('cat');
33         $this->assertTrue($handler->hasErrorThatContains('cat'));
34
35         $this->get('/books/arandomnotfouindbook');
36         $this->get($book->getUrl('/chapter/arandomnotfouindchapter'));
37         $this->get($book->getUrl('/chapter/arandomnotfouindpages'));
38
39         $this->assertCount(1, $handler->getRecords());
40     }
41 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.