mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge remote branch 'origin/master' into translation-staging
This commit is contained in:
commit
054c5a98fb
@ -205,11 +205,10 @@ class ContentController extends Controller {
|
|||||||
* @uses ErrorPage::response_for()
|
* @uses ErrorPage::response_for()
|
||||||
*/
|
*/
|
||||||
public function httpError($code, $message = null) {
|
public function httpError($code, $message = null) {
|
||||||
if($this->request->isMedia() || !$response = ErrorPage::response_for($code)) {
|
// Don't use the HTML response for media requests
|
||||||
parent::httpError($code, $message);
|
$response = $this->request->isMedia() ? null : ErrorPage::response_for($code);
|
||||||
} else {
|
// Failover to $message if the HTML response is unavailable / inappropriate
|
||||||
throw new SS_HTTPResponse_Exception($response);
|
parent::httpError($code, $response ? $response : $message);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,11 +126,8 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
return $this->response;
|
return $this->response;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($response = ErrorPage::response_for(404)) {
|
$response = ErrorPage::response_for(404);
|
||||||
return $response;
|
$this->httpError(404, $response ? $response : 'The requested page could not be found.');
|
||||||
} else {
|
|
||||||
$this->httpError(404, 'The requested page could not be found.');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enforce current locale setting to the loaded SiteTree object
|
// Enforce current locale setting to the loaded SiteTree object
|
||||||
|
@ -86,7 +86,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
*/
|
*/
|
||||||
public function testVersionsForm() {
|
public function testVersionsForm() {
|
||||||
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
||||||
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
|
$form = $this->cssParser()->getBySelector('#Form_VersionsForm');
|
||||||
|
|
||||||
$this->assertEquals(1, count($form));
|
$this->assertEquals(1, count($form));
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
|
|
||||||
public function testVersionsFormTableContainsInformation() {
|
public function testVersionsFormTableContainsInformation() {
|
||||||
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
||||||
$form = $this->cssParser()->getBySelector("#Form_VersionsForm");
|
$form = $this->cssParser()->getBySelector('#Form_VersionsForm');
|
||||||
$rows = $form[0]->xpath("fieldset/table/tbody/tr");
|
$rows = $form[0]->xpath("fieldset/table/tbody/tr");
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
@ -128,7 +128,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
|
|
||||||
public function testVersionsFormSelectsUnpublishedCheckbox() {
|
public function testVersionsFormSelectsUnpublishedCheckbox() {
|
||||||
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
$history = $this->get('admin/pages/history/show/'. $this->page->ID);
|
||||||
$checkbox = $this->cssParser()->getBySelector("#Form_VersionsForm #ShowUnpublished input");
|
$checkbox = $this->cssParser()->getBySelector('#Form_VersionsForm_ShowUnpublished');
|
||||||
|
|
||||||
$this->assertThat($checkbox[0], $this->logicalNot($this->isNull()));
|
$this->assertThat($checkbox[0], $this->logicalNot($this->isNull()));
|
||||||
$checked = $checkbox[0]->attributes()->checked;
|
$checked = $checkbox[0]->attributes()->checked;
|
||||||
@ -137,7 +137,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest {
|
|||||||
|
|
||||||
// viewing an unpublished
|
// viewing an unpublished
|
||||||
$history = $this->get('admin/pages/history/show/'.$this->page->ID .'/'.$this->versionUnpublishedCheck);
|
$history = $this->get('admin/pages/history/show/'.$this->page->ID .'/'.$this->versionUnpublishedCheck);
|
||||||
$checkbox = $this->cssParser()->getBySelector("#Form_VersionsForm #ShowUnpublished input");
|
$checkbox = $this->cssParser()->getBySelector('#Form_VersionsForm_ShowUnpublished');
|
||||||
|
|
||||||
$this->assertThat($checkbox[0], $this->logicalNot($this->isNull()));
|
$this->assertThat($checkbox[0], $this->logicalNot($this->isNull()));
|
||||||
$this->assertEquals('checked', (string) $checkbox[0]->attributes()->checked);
|
$this->assertEquals('checked', (string) $checkbox[0]->attributes()->checked);
|
||||||
|
Loading…
Reference in New Issue
Block a user