mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Added DirectorTest->testURLParam() and DirectorTest->testURLParams()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@104711 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
25e6f8c08f
commit
017943b067
@ -7,6 +7,20 @@
|
||||
*/
|
||||
class DirectorTest extends SapphireTest {
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
Director::addRules(99, array(
|
||||
'DirectorTestRule/$Action/$ID/$OtherID' => 'DirectorTestRequest_Controller'
|
||||
));
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
// TODO Remove director rule, currently API doesnt allow this
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testFileExists() {
|
||||
$tempFileName = 'DirectorTest_testFileExists.tmp';
|
||||
$tempFilePath = TEMP_FOLDER . '/' . $tempFileName;
|
||||
@ -154,6 +168,28 @@ class DirectorTest extends SapphireTest {
|
||||
}
|
||||
}
|
||||
|
||||
function testURLParam() {
|
||||
Director::test('DirectorTestRule/myaction/myid/myotherid');
|
||||
// TODO Works on the assumption that urlParam() is not unset after a test run, which is dodgy
|
||||
$this->assertEquals(Director::urlParam('Action'), 'myaction');
|
||||
$this->assertEquals(Director::urlParam('ID'), 'myid');
|
||||
$this->assertEquals(Director::urlParam('OtherID'), 'myotherid');
|
||||
}
|
||||
|
||||
function testURLParams() {
|
||||
Director::test('DirectorTestRule/myaction/myid/myotherid');
|
||||
// TODO Works on the assumption that urlParam() is not unset after a test run, which is dodgy
|
||||
$this->assertEquals(
|
||||
Director::urlParams(),
|
||||
array(
|
||||
'Controller' => 'DirectorTestRequest_Controller',
|
||||
'Action' => 'myaction',
|
||||
'ID' => 'myid',
|
||||
'OtherID' => 'myotherid'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DirectorTestRequest_Controller extends Controller implements TestOnly {
|
||||
|
Loading…
Reference in New Issue
Block a user