Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function testGetEditForm() |
||
18 | { |
||
19 | $id = $this->idFromFixture(SiteTree::class, 'page_one'); |
||
20 | |||
21 | $controller = CMSPageHistoryViewerController::create(); |
||
22 | |||
23 | $controller->setRequest( |
||
24 | (new HTTPRequest('GET', '/')) |
||
25 | ->setSession(new Session([])) |
||
26 | ); |
||
27 | |||
28 | $result = $controller->getEditForm($id); |
||
29 | $this->assertInstanceOf(Form::class, $result); |
||
30 | |||
31 | $historyViewer = $result->Fields()->fieldByName('PageHistory'); |
||
32 | $this->assertInstanceOf(HistoryViewerField::class, $historyViewer, 'Field is injected'); |
||
33 | $this->assertSame($result, $historyViewer->getForm(), 'Correct form is injected'); |
||
34 | } |
||
36 |