Merge remote-tracking branch 'origin/3.2' into 3

This commit is contained in:
Damian Mooyman 2015-07-31 14:34:04 +12:00
commit 71b23b622c
3 changed files with 36 additions and 15 deletions

View File

@ -1,4 +1,11 @@
language: php
language: php
sudo: false
addons:
apt:
packages:
- tidy
php:
- 5.4
@ -20,8 +27,13 @@ env:
matrix:
allow_failures:
- php: hhvm-nightly
- 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
@ -30,11 +42,12 @@ matrix:
env: DB=MYSQL BEHAT_TEST=1
- php: 5.3
env: DB=MYSQL
- php: hhvm-nightly
- php: 7.0
env: DB=MYSQL
- php: nightly
env: DB=MYSQL
- php: hhvm
env: DB=MYSQL
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y tidy
before_script:
- composer self-update || true

View File

@ -402,15 +402,15 @@ HTML;
if($action == "index") $action = "";
else $action = '_' . $action;
// Find templates by dataRecord
$templates = SSViewer::get_templates_by_class(get_class($this->dataRecord), $action, "SiteTree");
// Next, we need to add templates for all controllers
$templates += SSViewer::get_templates_by_class(get_class($this), $action, "Controller");
// Fail-over to the same for the "index" action
$templates += SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SiteTree");
$templates += SSViewer::get_templates_by_class(get_class($this), "", "Controller");
$templates = array_merge(
// Find templates by dataRecord
SSViewer::get_templates_by_class(get_class($this->dataRecord), $action, "SiteTree"),
// Next, we need to add templates for all controllers
SSViewer::get_templates_by_class(get_class($this), $action, "Controller"),
// Fail-over to the same for the "index" action
SSViewer::get_templates_by_class(get_class($this->dataRecord), "", "SiteTree"),
SSViewer::get_templates_by_class(get_class($this), "", "Controller")
);
return new SSViewer($templates);
}

View File

@ -168,6 +168,14 @@ class ContentControllerTest extends FunctionalTest {
// to say the default Page.ss template
$response = $self->get($page->RelativeLink("testwithouttemplate"));
$self->assertEquals("Page", $response->getBody());
// Test that an action with a template will render the both action template *and* the
// correct parent template
$controller = new ContentController($page);
$viewer = $controller->getViewer('test');
$templateList = array('ContentControllerTestPage_test', 'Page');
$expected = SS_TemplateLoader::instance()->findTemplates($templateList, 'controllertest');
$self->assertEquals($expected, $viewer->templates());
});
}