diff --git a/tests/controller/ContentControllerTest.php b/tests/controller/ContentControllerTest.php index e87a2c09..8351c145 100755 --- a/tests/controller/ContentControllerTest.php +++ b/tests/controller/ContentControllerTest.php @@ -132,40 +132,43 @@ class ContentControllerTest extends FunctionalTest { * @covers ContentController::getViewer() **/ public function testGetViewer() { + + $self = $this; + $this->useTestTheme(dirname(__FILE__), 'controllertest', function() use ($self) { - // Test a page without a controller (ContentControllerTest_PageWithoutController.ss) - $page = new ContentControllerTestPageWithoutController(); - $page->URLSegment = "test"; - $page->write(); - $page->publish("Stage", "Live"); + // Test a page without a controller (ContentControllerTest_PageWithoutController.ss) + $page = new ContentControllerTestPageWithoutController(); + $page->URLSegment = "test"; + $page->write(); + $page->publish("Stage", "Live"); - $response = $this->get($page->RelativeLink()); - $this->assertEquals("ContentControllerTestPageWithoutController", $response->getBody()); + $response = $self->get($page->RelativeLink()); + $self->assertEquals("ContentControllerTestPageWithoutController", $response->getBody()); + + // // This should fall over to user Page.ss + $page = new ContentControllerTestPage(); + $page->URLSegment = "test"; + $page->write(); + $page->publish("Stage", "Live"); + + $response = $self->get($page->RelativeLink()); + $self->assertEquals("Page", $response->getBody()); - // // This should fall over to user Page.ss - $page = new ContentControllerTestPage(); - $page->URLSegment = "test"; - $page->write(); - $page->publish("Stage", "Live"); + // Test that the action template is rendered. + $page = new ContentControllerTestPage(); + $page->URLSegment = "page-without-controller"; + $page->write(); + $page->publish("Stage", "Live"); - $response = $this->get($page->RelativeLink()); - $this->assertEquals("Foo", $response->getBody()); + $response = $self->get($page->RelativeLink("test")); + $self->assertEquals("ContentControllerTestPage_test", $response->getBody()); - - // Test that the action template is rendered. - $page = new ContentControllerTestPage(); - $page->URLSegment = "page-without-controller"; - $page->write(); - $page->publish("Stage", "Live"); - - $response = $this->get($page->RelativeLink("test")); - $this->assertEquals("ContentControllerTestPage_test", $response->getBody()); - - // Test that an action without a template will default to the index template, which is - // to say the default Page.ss template - $response = $this->get($page->RelativeLink("testwithouttemplate")); - $this->assertEquals("Foo", $response->getBody()); + // Test that an action without a template will default to the index template, which is + // to say the default Page.ss template + $response = $self->get($page->RelativeLink("testwithouttemplate")); + $self->assertEquals("Page", $response->getBody()); + }); } } diff --git a/tests/templates/ContentControllerTestPageWithoutController.ss b/tests/controller/themes/controllertest/ContentControllerTestPageWithoutController.ss similarity index 100% rename from tests/templates/ContentControllerTestPageWithoutController.ss rename to tests/controller/themes/controllertest/ContentControllerTestPageWithoutController.ss diff --git a/tests/templates/ContentControllerTestPage_test.ss b/tests/controller/themes/controllertest/ContentControllerTestPage_test.ss similarity index 100% rename from tests/templates/ContentControllerTestPage_test.ss rename to tests/controller/themes/controllertest/ContentControllerTestPage_test.ss diff --git a/tests/controller/themes/controllertest/Controller.ss b/tests/controller/themes/controllertest/Controller.ss new file mode 100644 index 00000000..0704454f --- /dev/null +++ b/tests/controller/themes/controllertest/Controller.ss @@ -0,0 +1 @@ +Controller \ No newline at end of file diff --git a/tests/controller/themes/controllertest/Layout/Page.ss b/tests/controller/themes/controllertest/Layout/Page.ss new file mode 100644 index 00000000..560c7d73 --- /dev/null +++ b/tests/controller/themes/controllertest/Layout/Page.ss @@ -0,0 +1 @@ +Page \ No newline at end of file diff --git a/tests/controller/themes/controllertest/Page.ss b/tests/controller/themes/controllertest/Page.ss new file mode 100644 index 00000000..7ab05d93 --- /dev/null +++ b/tests/controller/themes/controllertest/Page.ss @@ -0,0 +1 @@ +$Layout \ No newline at end of file