1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 19:32:29 +01:00

Updated public view test case to be more reliable

Was failing due to either common name or view share being
sticky across requests.
This commit is contained in:
Dan Brown 2021-04-20 21:59:17 +01:00
parent 20528a2442
commit ec827da5a5

View File

@ -8,6 +8,7 @@ use BookStack\Auth\User;
use BookStack\Entities\Models\Book; use BookStack\Entities\Models\Book;
use BookStack\Entities\Models\Chapter; use BookStack\Entities\Models\Chapter;
use BookStack\Entities\Models\Page; use BookStack\Entities\Models\Page;
use Illuminate\Support\Facades\View;
class PublicActionTest extends TestCase class PublicActionTest extends TestCase
{ {
@ -115,10 +116,12 @@ class PublicActionTest extends TestCase
public function test_content_not_listed_on_404_for_public_users() public function test_content_not_listed_on_404_for_public_users()
{ {
$page = Page::query()->first(); $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 $this->asAdmin()->get($page->getUrl()); // Fake visit to show on recents
$resp = $this->get('/cats/dogs/hippos'); $resp = $this->get('/cats/dogs/hippos');
$resp->assertStatus(404); $resp->assertStatus(404);
$resp->assertSee($page->name); $resp->assertSee($page->name);
View::share('pageTitle', '');
Auth::logout(); Auth::logout();
$resp = $this->get('/cats/dogs/hippos'); $resp = $this->get('/cats/dogs/hippos');