]> BookStack Code Mirror - bookstack/blob - tests/HomepageTest.php
Updated Spanish translation
[bookstack] / tests / HomepageTest.php
1 <?php namespace Tests;
2
3 class HomepageTest extends TestCase
4 {
5
6     public function test_default_homepage_visible()
7     {
8         $this->asEditor();
9         $homeVisit = $this->get('/');
10         $homeVisit->assertSee('My Recently Viewed');
11         $homeVisit->assertSee('Recently Updated Pages');
12         $homeVisit->assertSee('Recent Activity');
13     }
14
15     public function test_custom_homepage()
16     {
17         $this->asEditor();
18         $name = 'My custom homepage';
19         $content = 'This is the body content of my custom homepage.';
20         $customPage = $this->newPage(['name' => $name, 'html' => $content]);
21         $this->setSettings(['app-homepage' => $customPage->id]);
22
23         $homeVisit = $this->get('/');
24         $homeVisit->assertSee($name);
25         $homeVisit->assertSee($content);
26         $homeVisit->assertSee('My Recently Viewed');
27         $homeVisit->assertSee('Recently Updated Pages');
28         $homeVisit->assertSee('Recent Activity');
29     }
30
31     public function test_delete_custom_homepage()
32     {
33         $this->asEditor();
34         $name = 'My custom homepage';
35         $content = 'This is the body content of my custom homepage.';
36         $customPage = $this->newPage(['name' => $name, 'html' => $content]);
37         $this->setSettings(['app-homepage' => $customPage->id]);
38
39         $homeVisit = $this->get('/');
40         $homeVisit->assertSee($name);
41
42         $pageDeleteReq = $this->delete($customPage->getUrl());
43         $pageDeleteReq->assertStatus(302);
44         $pageDeleteReq->assertRedirect($customPage->getUrl());
45         $pageDeleteReq->assertSessionHas('error');
46         $pageDeleteReq->assertSessionMissing('success');
47
48         $homeVisit = $this->get('/');
49         $homeVisit->assertSee($name);
50         $homeVisit->assertStatus(200);
51     }
52 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.