From 5f8839b6d8c50452465b270561350162beb14ec5 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 5 May 2009 22:12:38 +0000 Subject: [PATCH] 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 --- tests/LeftAndMainTest.php | 1 + tests/ModelAdminTest.php | 29 +++++++++++++++++++++++++++++ tests/ModelAdminTest.yml | 19 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/ModelAdminTest.php create mode 100644 tests/ModelAdminTest.yml diff --git a/tests/LeftAndMainTest.php b/tests/LeftAndMainTest.php index 4997d731..d5b3a527 100644 --- a/tests/LeftAndMainTest.php +++ b/tests/LeftAndMainTest.php @@ -11,6 +11,7 @@ class LeftAndMainTest extends FunctionalTest { // @todo fix controller stack problems and re-activate //$this->autoFollowRedirection = false; + CMSMenu::populate_menu(); } /** diff --git a/tests/ModelAdminTest.php b/tests/ModelAdminTest.php new file mode 100644 index 00000000..a5ae5252 --- /dev/null +++ b/tests/ModelAdminTest.php @@ -0,0 +1,29 @@ +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", + ); +} \ No newline at end of file diff --git a/tests/ModelAdminTest.yml b/tests/ModelAdminTest.yml new file mode 100644 index 00000000..1a1758b5 --- /dev/null +++ b/tests/ModelAdminTest.yml @@ -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 \ No newline at end of file