mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-28 13:36:12 +02:00
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65782 467b73ca-7a2a-4603-9d3b-597d59a354a9
33 lines
748 B
PHP
33 lines
748 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
class ModelAsControllerTest extends SapphireTest {
|
|
|
|
public function testFindOldPage() {
|
|
$page = new Page();
|
|
$page->Title = 'Test Page';
|
|
$page->URLSegment = 'test-page';
|
|
$page->write();
|
|
$page->publish('Stage', 'Live');
|
|
|
|
$page->URLSegment = 'test';
|
|
$page->write();
|
|
$page->publish('Stage', 'Live');
|
|
|
|
$router = new ModelAsController();
|
|
$request = new HTTPRequest(
|
|
'GET', 'test-page/action/id/otherid'
|
|
);
|
|
$request->match('$URLSegment/$Action/$ID/$OtherID');
|
|
$response = $router->handleRequest($request);
|
|
|
|
$this->assertEquals (
|
|
$response->getHeader('Location'),
|
|
Controller::join_links(Director::baseURL() . 'test/action/id/otherid')
|
|
);
|
|
}
|
|
|
|
}
|