mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUG Fix ContentControllerTest
This commit is contained in:
parent
b497b8f548
commit
4b87b2e2e6
@ -133,15 +133,17 @@ class ContentControllerTest extends FunctionalTest {
|
|||||||
**/
|
**/
|
||||||
public function testGetViewer() {
|
public function testGetViewer() {
|
||||||
|
|
||||||
|
$self = $this;
|
||||||
|
$this->useTestTheme(dirname(__FILE__), 'controllertest', function() use ($self) {
|
||||||
|
|
||||||
// Test a page without a controller (ContentControllerTest_PageWithoutController.ss)
|
// Test a page without a controller (ContentControllerTest_PageWithoutController.ss)
|
||||||
$page = new ContentControllerTestPageWithoutController();
|
$page = new ContentControllerTestPageWithoutController();
|
||||||
$page->URLSegment = "test";
|
$page->URLSegment = "test";
|
||||||
$page->write();
|
$page->write();
|
||||||
$page->publish("Stage", "Live");
|
$page->publish("Stage", "Live");
|
||||||
|
|
||||||
$response = $this->get($page->RelativeLink());
|
$response = $self->get($page->RelativeLink());
|
||||||
$this->assertEquals("ContentControllerTestPageWithoutController", $response->getBody());
|
$self->assertEquals("ContentControllerTestPageWithoutController", $response->getBody());
|
||||||
|
|
||||||
|
|
||||||
// // This should fall over to user Page.ss
|
// // This should fall over to user Page.ss
|
||||||
$page = new ContentControllerTestPage();
|
$page = new ContentControllerTestPage();
|
||||||
@ -149,8 +151,8 @@ class ContentControllerTest extends FunctionalTest {
|
|||||||
$page->write();
|
$page->write();
|
||||||
$page->publish("Stage", "Live");
|
$page->publish("Stage", "Live");
|
||||||
|
|
||||||
$response = $this->get($page->RelativeLink());
|
$response = $self->get($page->RelativeLink());
|
||||||
$this->assertEquals("Foo", $response->getBody());
|
$self->assertEquals("Page", $response->getBody());
|
||||||
|
|
||||||
|
|
||||||
// Test that the action template is rendered.
|
// Test that the action template is rendered.
|
||||||
@ -159,13 +161,14 @@ class ContentControllerTest extends FunctionalTest {
|
|||||||
$page->write();
|
$page->write();
|
||||||
$page->publish("Stage", "Live");
|
$page->publish("Stage", "Live");
|
||||||
|
|
||||||
$response = $this->get($page->RelativeLink("test"));
|
$response = $self->get($page->RelativeLink("test"));
|
||||||
$this->assertEquals("ContentControllerTestPage_test", $response->getBody());
|
$self->assertEquals("ContentControllerTestPage_test", $response->getBody());
|
||||||
|
|
||||||
// Test that an action without a template will default to the index template, which is
|
// Test that an action without a template will default to the index template, which is
|
||||||
// to say the default Page.ss template
|
// to say the default Page.ss template
|
||||||
$response = $this->get($page->RelativeLink("testwithouttemplate"));
|
$response = $self->get($page->RelativeLink("testwithouttemplate"));
|
||||||
$this->assertEquals("Foo", $response->getBody());
|
$self->assertEquals("Page", $response->getBody());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
1
tests/controller/themes/controllertest/Controller.ss
Normal file
1
tests/controller/themes/controllertest/Controller.ss
Normal file
@ -0,0 +1 @@
|
|||||||
|
Controller
|
1
tests/controller/themes/controllertest/Layout/Page.ss
Normal file
1
tests/controller/themes/controllertest/Layout/Page.ss
Normal file
@ -0,0 +1 @@
|
|||||||
|
Page
|
1
tests/controller/themes/controllertest/Page.ss
Normal file
1
tests/controller/themes/controllertest/Page.ss
Normal file
@ -0,0 +1 @@
|
|||||||
|
$Layout
|
Loading…
Reference in New Issue
Block a user