From f3176763412e8f31fc42ba0543bbd0e544471236 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 21 Nov 2008 01:11:49 +0000 Subject: [PATCH] Merged pre-2.3-oct08 into trunk git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@66355 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/LeftAndMainTest.php | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/tests/LeftAndMainTest.php b/tests/LeftAndMainTest.php index 1fb53492..9ac7c152 100644 --- a/tests/LeftAndMainTest.php +++ b/tests/LeftAndMainTest.php @@ -3,9 +3,38 @@ * @package cms * @subpackage tests */ -/* class LeftAndMainTest extends SapphireTest { + static $fixture_file = 'cms/tests/CMSMainTest.yml'; + + /** + * Check that all subclasses of leftandmain can be accessed + */ + public function testLeftAndMainSubclasses() { + $session = new Session(array( + 'loggedInAs' => $this->idFromFixture('Member','admin') + )); + + // This controller stuff is needed because LeftAndMain::MainMenu() inspects the current user's permissions + $controller = new Controller(); + $controller->setSession($session); + $controller->pushCurrent(); + $menuItems = singleton('CMSMain')->MainMenu(); + $controller->popCurrent(); + + $classes = ClassInfo::subclassesFor("LeftAndMain"); + foreach($menuItems as $menuItem) { + $link = $menuItem->Link; + if(preg_match('/^https?:\/\//',$link)) continue; + + $response = Director::test($link, null, $session); + $this->assertType('HTTPResponse', $response, "$link should return a response object"); + $this->assertEquals(200, $response->getStatusCode(), "$link should return 200 status code"); + // Check that a HTML page has been returned + $this->assertRegExp('/]*>/i', $response->getBody(), "$link should contain tag"); + $this->assertRegExp('/]*>/i', $response->getBody(), "$link should contain tag"); + $this->assertRegExp('/]*>/i', $response->getBody(), "$link should contain tag"); + } + } } -*/ -?> \ No newline at end of file +