mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-05 17:21:16 +02:00
32 lines
787 B
PHP
32 lines
787 B
PHP
|
<?php
|
||
|
|
||
|
class ModelAdminTest extends FunctionalTest {
|
||
|
static $fixture_file = 'sapphire/admin/tests/ModelAdminTest.yml';
|
||
|
|
||
|
protected $extraDataObjects = array(
|
||
|
'ModelAdminTest_Admin',
|
||
|
'ModelAdminTest_Contact',
|
||
|
);
|
||
|
|
||
|
function testModelAdminOpens() {
|
||
|
$this->autoFollowRedirection = false;
|
||
|
$this->logInAs('admin');
|
||
|
$this->assertTrue((bool)Permission::check("ADMIN"));
|
||
|
$this->assertEquals(200, $this->get('ModelAdminTest_Admin')->getStatusCode());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class ModelAdminTest_Admin extends ModelAdmin implements TestOnly {
|
||
|
static $url_segment = 'testadmin';
|
||
|
|
||
|
public static $managed_models = array(
|
||
|
'ModelAdminTest_Contact',
|
||
|
);
|
||
|
}
|
||
|
|
||
|
class ModelAdminTest_Contact extends DataObject implements TestOnly {
|
||
|
static $db = array(
|
||
|
"Name" => "Varchar",
|
||
|
"Phone" => "Varchar",
|
||
|
);
|
||
|
}
|