]> BookStack Code Mirror - bookstack/blob - tests/Entity/PageRevisionTest.php
Fixes issue with code not wrapping on revision page.
[bookstack] / tests / Entity / PageRevisionTest.php
1 <?php namespace Entity;
2
3
4 use BookStack\Page;
5 use Tests\TestCase;
6
7 class PageRevisionTest extends TestCase
8 {
9
10     public function test_page_revision_count_increments_on_update()
11     {
12         $page = Page::first();
13         $startCount = $page->revision_count;
14
15         $resp = $this->asEditor()->put($page->getUrl(), ['name' => 'Updated page', 'html' => 'new page html', 'summary' => 'Update a']);
16         $resp->assertStatus(302);
17
18         $this->assertTrue(Page::find($page->id)->revision_count === $startCount+1);
19     }
20
21     public function test_revision_count_shown_in_page_meta()
22     {
23         $page = Page::first();
24         $this->asEditor()->put($page->getUrl(), ['name' => 'Updated page', 'html' => 'new page html', 'summary' => 'Update a']);
25         $this->asEditor()->put($page->getUrl(), ['name' => 'Updated page', 'html' => 'new page html', 'summary' => 'Update a']);
26         $page = Page::find($page->id);
27
28         $pageView = $this->get($page->getUrl());
29         $pageView->assertSee('Revision #' . $page->revision_count);
30     }
31
32 }