From ec827da5a57d5b00ced91620ac4fc22b759c93d6 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Tue, 20 Apr 2021 21:59:17 +0100 Subject: [PATCH] Updated public view test case to be more reliable Was failing due to either common name or view share being sticky across requests. --- tests/PublicActionTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/PublicActionTest.php b/tests/PublicActionTest.php index 7caefd0ac..7dbf467bd 100644 --- a/tests/PublicActionTest.php +++ b/tests/PublicActionTest.php @@ -8,6 +8,7 @@ use BookStack\Auth\User; use BookStack\Entities\Models\Book; use BookStack\Entities\Models\Chapter; use BookStack\Entities\Models\Page; +use Illuminate\Support\Facades\View; class PublicActionTest extends TestCase { @@ -115,10 +116,12 @@ class PublicActionTest extends TestCase public function test_content_not_listed_on_404_for_public_users() { $page = Page::query()->first(); + $page->fill(['name' => 'my testing random unique page name'])->save(); $this->asAdmin()->get($page->getUrl()); // Fake visit to show on recents $resp = $this->get('/cats/dogs/hippos'); $resp->assertStatus(404); $resp->assertSee($page->name); + View::share('pageTitle', ''); Auth::logout(); $resp = $this->get('/cats/dogs/hippos');