mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Added DirectorTest->testURLParam() and DirectorTest->testURLParams() (from r104711)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112376 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8ea659be69
commit
ecb758de10
@ -7,6 +7,20 @@
|
|||||||
*/
|
*/
|
||||||
class DirectorTest extends SapphireTest {
|
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() {
|
public function testFileExists() {
|
||||||
$tempFileName = 'DirectorTest_testFileExists.tmp';
|
$tempFileName = 'DirectorTest_testFileExists.tmp';
|
||||||
$tempFilePath = TEMP_FOLDER . '/' . $tempFileName;
|
$tempFilePath = TEMP_FOLDER . '/' . $tempFileName;
|
||||||
@ -147,6 +161,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 {
|
class DirectorTestRequest_Controller extends Controller implements TestOnly {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user