MINOR: Added additional tests for LeftAndMain and ModelAdmin

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@76112 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-05-05 22:12:38 +00:00
parent b456a2c56e
commit 5f8839b6d8
3 changed files with 49 additions and 0 deletions

View File

@ -11,6 +11,7 @@ class LeftAndMainTest extends FunctionalTest {
// @todo fix controller stack problems and re-activate
//$this->autoFollowRedirection = false;
CMSMenu::populate_menu();
}
/**

29
tests/ModelAdminTest.php Normal file
View File

@ -0,0 +1,29 @@
<?php
class ModelAdminTest extends FunctionalTest {
static $fixture_file = 'cms/tests/ModelAdminTest.yml';
function testModelAdminOpens() {
$this->autoFollowRedirection = false;
$this->logInAs('admin');
$this->assertTrue((bool)Permission::check("ADMIN"));
Debug::message($this->get('ModelAdminTest_Admin')->getBody());
$this->assertEquals(200, $this->get('ModelAdminTest_Admin')->getStatusCode());
}
}
class ModelAdminTest_Admin extends ModelAdmin {
static $url_segment = 'testadmin';
protected static $managed_models = array(
'ModelAdminTest_Contact',
);
}
class ModelAdminTest_Contact extends DataObject {
static $db = array(
"Name" => "Varchar",
"Phone" => "Varchar",
);
}

19
tests/ModelAdminTest.yml Normal file
View File

@ -0,0 +1,19 @@
ModelAdminTest_Contact:
sam:
Name: Sam
Phone: 021 123 456
ingo:
Name: ingo
Phone: 04 987 6543
Member:
admin:
FirstName: admin
Group:
admin:
Title: Admin
Members: =>Member.admin
Permission:
admin:
Code: ADMIN
Group: =>Group.admin