mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge remote-tracking branch 'origin/3.1' into 3.2
Conflicts: .travis.yml
This commit is contained in:
commit
f2efbefb8c
39
.travis.yml
39
.travis.yml
@ -7,9 +7,6 @@ addons:
|
||||
packages:
|
||||
- tidy
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
|
||||
addons:
|
||||
firefox: "31.0"
|
||||
|
||||
@ -20,34 +17,19 @@ env:
|
||||
- "ARTIFACTS_S3_BUCKET=silverstripe-travis-artifacts"
|
||||
- secure: "7V20Qk3bIG2AlTJaA5D/uzB8vUVvRwQp+xjRYUxlahtj9FcuqEV3HIyjwwJe0T6Z1bnRYuu28ZnCT2CfP9BBZ3FE7AwSZbPase9c0/at2qDJNqkvIdC1xZ1H6Fcy2LSwNB9wLQPe613ItVdanitEuwE41iowxBPslxUUTnwx7eY="
|
||||
- secure: "f/GWlbnNri2YpCOrJfZl7tkhpMmcRVUbCdmb+beAY90gFBJQPHtljzf8M4KaCP0OkLOtRFuGoMFdIcpadl4J6IG1XP18IJNz+nKzCL/sJj/FF9y77RdMHWE9jr21G9ar5tywkn7JM6vrnTCY89OnHeQx67SKvxqX5CpVx+rdcEU="
|
||||
matrix:
|
||||
- DB=MYSQL
|
||||
- DB=SQLITE
|
||||
- DB=PGSQL
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: 7.0
|
||||
- php: nightly
|
||||
|
||||
include:
|
||||
- php: 5.4
|
||||
env: DB=MYSQL PDO=1
|
||||
- php: 5.5
|
||||
env: DB=MYSQL
|
||||
- php: 5.6
|
||||
env: DB=MYSQL
|
||||
- php: 5.4
|
||||
env: DB=MYSQL BEHAT_TEST=1
|
||||
- php: 5.3
|
||||
env: DB=MYSQL
|
||||
- php: 7.0
|
||||
env: DB=MYSQL
|
||||
- php: nightly
|
||||
env: DB=MYSQL
|
||||
- php: hhvm
|
||||
env: DB=MYSQL
|
||||
- php: 5.4
|
||||
env: DB=PGSQL
|
||||
- php: 5.5
|
||||
env: DB=SQLITE
|
||||
- php: 5.6
|
||||
env: DB=MYSQL PDO=1
|
||||
- php: 5.6
|
||||
env: DB=MYSQL BEHAT_TEST=1
|
||||
|
||||
before_script:
|
||||
- composer self-update || true
|
||||
@ -72,8 +54,3 @@ branches:
|
||||
- 2.2
|
||||
- 2.3
|
||||
- translation-staging
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
- "irc.freenode.org#silverstripe"
|
||||
|
@ -10,8 +10,8 @@ class OldPageRedirector extends Extension {
|
||||
* @throws SS_HTTPResponse_Exception
|
||||
*/
|
||||
public function onBeforeHTTPError404($request) {
|
||||
// Build up the request parameters
|
||||
$params = array_filter(array_values($request->allParams()), function($v) { return ($v !== NULL); });
|
||||
// We need to get the URL ourselves because $request->allParams() only has a max of 4 params
|
||||
$params = preg_split('|/+|', $request->getURL());
|
||||
|
||||
$getvars = $request->getVars();
|
||||
unset($getvars['url']);
|
||||
|
@ -115,6 +115,60 @@ class ModelAsControllerTest extends FunctionalTest {
|
||||
$response = $this->get('newlevel1/newlevel2/level3');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the redirect works even with a lot of nested pages
|
||||
* Original: /oldurl/level2/level3/level4/level5
|
||||
* New: /newurl/level2/level3/level4/level5
|
||||
*/
|
||||
public function testHeavilyNestedRenamedRedirectedPages() {
|
||||
$page = new Page();
|
||||
$page->Title = 'First Level';
|
||||
$page->URLSegment = 'oldurl';
|
||||
$page->write();
|
||||
$page->publish('Stage', 'Live');
|
||||
|
||||
$page->URLSegment = 'newurl';
|
||||
$page->write();
|
||||
$page->publish('Stage', 'Live');
|
||||
|
||||
$page2 = new Page();
|
||||
$page2->Title = 'Second Level Page';
|
||||
$page2->URLSegment = 'level2';
|
||||
$page2->ParentID = $page->ID;
|
||||
$page2->write();
|
||||
$page2->publish('Stage', 'Live');
|
||||
|
||||
$page3 = new Page();
|
||||
$page3->Title = 'Third Level Page';
|
||||
$page3->URLSegment = 'level3';
|
||||
$page3->ParentID = $page2->ID;
|
||||
$page3->write();
|
||||
$page3->publish('Stage', 'Live');
|
||||
|
||||
$page4 = new Page();
|
||||
$page4->Title = 'Fourth Level Page';
|
||||
$page4->URLSegment = 'level4';
|
||||
$page4->ParentID = $page3->ID;
|
||||
$page4->write();
|
||||
$page4->publish('Stage', 'Live');
|
||||
|
||||
$page5 = new Page();
|
||||
$page5->Title = 'Fifth Level Page';
|
||||
$page5->URLSegment = 'level5';
|
||||
$page5->ParentID = $page4->ID;
|
||||
$page5->write();
|
||||
$page5->publish('Stage', 'Live');
|
||||
|
||||
// Test that the redirect still works fine when trying to access the most nested page
|
||||
$response = $this->get('oldurl/level2/level3/level4/level5/');
|
||||
$this->assertEquals($response->getStatusCode(), 301);
|
||||
$this->assertEquals(
|
||||
Controller::join_links(Director::baseURL() . 'newurl/level2/level3/level4/level5/'),
|
||||
$response->getHeader('Location')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function testRedirectionForPreNestedurlsBookmarks(){
|
||||
$this->generateNestedPagesFixture();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user