3 use BookStack\JointPermission;
5 use BookStack\Repos\EntityRepo;
7 class HomepageTest extends TestCase
10 public function test_default_homepage_visible()
13 $homeVisit = $this->get('/');
14 $homeVisit->assertSee('My Recently Viewed');
15 $homeVisit->assertSee('Recently Updated Pages');
16 $homeVisit->assertSee('Recent Activity');
19 public function test_custom_homepage()
22 $name = 'My custom homepage';
23 $content = 'This is the body content of my custom homepage.';
24 $customPage = $this->newPage(['name' => $name, 'html' => $content]);
25 $this->setSettings(['app-homepage' => $customPage->id]);
27 $homeVisit = $this->get('/');
28 $homeVisit->assertSee($name);
29 $homeVisit->assertSee($content);
30 $homeVisit->assertSee('My Recently Viewed');
31 $homeVisit->assertSee('Recently Updated Pages');
32 $homeVisit->assertSee('Recent Activity');
35 public function test_delete_custom_homepage()
38 $name = 'My custom homepage';
39 $content = 'This is the body content of my custom homepage.';
40 $customPage = $this->newPage(['name' => $name, 'html' => $content]);
41 $this->setSettings(['app-homepage' => $customPage->id]);
43 $homeVisit = $this->get('/');
44 $homeVisit->assertSee($name);
46 $pageDeleteReq = $this->delete($customPage->getUrl());
47 $pageDeleteReq->assertStatus(302);
48 $pageDeleteReq->assertRedirect($customPage->getUrl());
49 $pageDeleteReq->assertSessionHas('error');
50 $pageDeleteReq->assertSessionMissing('success');
52 $homeVisit = $this->get('/');
53 $homeVisit->assertSee($name);
54 $homeVisit->assertStatus(200);