]> BookStack Code Mirror - bookstack/blob - tests/HomepageTest.php
Added Swedish locale to config
[bookstack] / tests / HomepageTest.php
1 <?php namespace Tests;
2
3 use BookStack\JointPermission;
4 use BookStack\Page;
5 use BookStack\Repos\EntityRepo;
6
7 class HomepageTest extends TestCase
8 {
9
10     public function test_default_homepage_visible()
11     {
12         $this->asEditor();
13         $homeVisit = $this->get('/');
14         $homeVisit->assertSee('My Recently Viewed');
15         $homeVisit->assertSee('Recently Updated Pages');
16         $homeVisit->assertSee('Recent Activity');
17     }
18
19     public function test_custom_homepage()
20     {
21         $this->asEditor();
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]);
26
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');
33     }
34
35     public function test_delete_custom_homepage()
36     {
37         $this->asEditor();
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]);
42
43         $homeVisit = $this->get('/');
44         $homeVisit->assertSee($name);
45
46         $pageDeleteReq = $this->delete($customPage->getUrl());
47         $pageDeleteReq->assertStatus(302);
48         $pageDeleteReq->assertRedirect($customPage->getUrl());
49         $pageDeleteReq->assertSessionHas('error');
50         $pageDeleteReq->assertSessionMissing('success');
51
52         $homeVisit = $this->get('/');
53         $homeVisit->assertSee($name);
54         $homeVisit->assertStatus(200);
55     }
56 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.