mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
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:
parent
b456a2c56e
commit
5f8839b6d8
@ -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
29
tests/ModelAdminTest.php
Normal 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
19
tests/ModelAdminTest.yml
Normal 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
|
Loading…
x
Reference in New Issue
Block a user