]> BookStack Code Mirror - bookstack/blobdiff - tests/ErrorTest.php
Updated callout link formatting
[bookstack] / tests / ErrorTest.php
index a5e4a4a5e58b9d1e237fa37240cca6d7079154de..8f6867cdeb0c357e16f9b7ce7df7df3813984200 100644 (file)
@@ -1,5 +1,8 @@
 <?php namespace Tests;
 
+use BookStack\Entities\Book;
+use Illuminate\Support\Facades\Log;
+
 class ErrorTest extends TestCase
 {
 
@@ -18,4 +21,21 @@ class ErrorTest extends TestCase
         $notFound->assertDontSeeText('Log in');
         $notFound->assertSeeText('tester');
     }
+
+    public function test_item_not_found_does_not_get_logged_to_file()
+    {
+        $this->actingAs($this->getViewer());
+        $handler = $this->withTestLogger();
+        $book = Book::query()->first();
+
+        // Ensure we're seeing errors
+        Log::error('cat');
+        $this->assertTrue($handler->hasErrorThatContains('cat'));
+
+        $this->get('/books/arandomnotfouindbook');
+        $this->get($book->getUrl('/chapter/arandomnotfouindchapter'));
+        $this->get($book->getUrl('/chapter/arandomnotfouindpages'));
+
+        $this->assertCount(1, $handler->getRecords());
+    }
 }
\ No newline at end of file