2008-11-13 03:18:12 +01:00
|
|
|
<?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();
|
API CHANGE: Renamed conflicting classes to have an "SS_" namespace, and renamed existing "SS" namespace to "SS_". The affected classes are: HTTPRequest, HTTPResponse, Query, Database, SSBacktrace, SSCli, SSDatetime, SSDatetimeTest, SSLog, SSLogTest, SSLogEmailWriter, SSLogErrorEmailFormatter, SSLogErrorFileFormatter, SSLogFileWriter and SSZendLog.
MINOR: Replaced usage of renamed classes with the new namespaced name.
From: Andrew Short <andrewjshort@gmail.com>
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90075 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-26 04:06:31 +01:00
|
|
|
$request = new SS_HTTPRequest(
|
2008-11-13 03:18:12 +01:00
|
|
|
'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')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|