2009-05-06 08:37:45 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class ModelAdminTest extends FunctionalTest {
|
|
|
|
static $fixture_file = 'cms/tests/ModelAdminTest.yml';
|
|
|
|
|
2010-04-13 05:27:47 +02:00
|
|
|
protected $extraDataObjects = array(
|
|
|
|
'ModelAdminTest_Admin',
|
|
|
|
'ModelAdminTest_Contact',
|
|
|
|
);
|
|
|
|
|
2009-05-06 08:37:45 +02:00
|
|
|
function testModelAdminOpens() {
|
|
|
|
$this->autoFollowRedirection = false;
|
|
|
|
$this->logInAs('admin');
|
|
|
|
$this->assertTrue((bool)Permission::check("ADMIN"));
|
|
|
|
$this->assertEquals(200, $this->get('ModelAdminTest_Admin')->getStatusCode());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-26 23:10:58 +02:00
|
|
|
class ModelAdminTest_Admin extends ModelAdmin implements TestOnly {
|
2009-05-06 08:37:45 +02:00
|
|
|
static $url_segment = 'testadmin';
|
|
|
|
|
|
|
|
public static $managed_models = array(
|
|
|
|
'ModelAdminTest_Contact',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2010-04-13 05:27:47 +02:00
|
|
|
class ModelAdminTest_Contact extends DataObject implements TestOnly {
|
2009-05-06 08:37:45 +02:00
|
|
|
static $db = array(
|
|
|
|
"Name" => "Varchar",
|
|
|
|
"Phone" => "Varchar",
|
|
|
|
);
|
|
|
|
}
|