Merge branch '2.3' into 2.7
Conflicts: src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php
This commit is contained in:
commit
4b0e4c4ee0
@ -18,31 +18,6 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class ExceptionControllerTest extends TestCase
|
||||
{
|
||||
public function testOnlyClearOwnOutputBuffers()
|
||||
{
|
||||
$flatten = $this->getMock('Symfony\Component\Debug\Exception\FlattenException');
|
||||
$flatten
|
||||
->expects($this->once())
|
||||
->method('getStatusCode')
|
||||
->will($this->returnValue(404));
|
||||
$twig = $this->getMockBuilder('\Twig_Environment')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$twig
|
||||
->expects($this->any())
|
||||
->method('render')
|
||||
->will($this->returnValue($this->getMock('Symfony\Component\HttpFoundation\Response')));
|
||||
$twig
|
||||
->expects($this->any())
|
||||
->method('getLoader')
|
||||
->will($this->returnValue($this->getMock('\Twig_LoaderInterface')));
|
||||
$request = Request::create('/');
|
||||
$request->headers->set('X-Php-Ob-Level', 1);
|
||||
|
||||
$controller = new ExceptionController($twig, false);
|
||||
$controller->showAction($request, $flatten);
|
||||
}
|
||||
|
||||
public function testShowActionCanBeForcedToShowErrorPage()
|
||||
{
|
||||
$twig = new \Twig_Environment(
|
||||
|
@ -58,7 +58,7 @@ class YamlFileLoader extends FileLoader
|
||||
}
|
||||
|
||||
try {
|
||||
$config = $this->yamlParser->parse(file_get_contents($path));
|
||||
$parsedConfig = $this->yamlParser->parse(file_get_contents($path));
|
||||
} catch (ParseException $e) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $path), 0, $e);
|
||||
}
|
||||
@ -67,16 +67,16 @@ class YamlFileLoader extends FileLoader
|
||||
$collection->addResource(new FileResource($path));
|
||||
|
||||
// empty file
|
||||
if (null === $config) {
|
||||
if (null === $parsedConfig) {
|
||||
return $collection;
|
||||
}
|
||||
|
||||
// not an array
|
||||
if (!is_array($config)) {
|
||||
if (!is_array($parsedConfig)) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path));
|
||||
}
|
||||
|
||||
foreach ($config as $name => $config) {
|
||||
foreach ($parsedConfig as $name => $config) {
|
||||
if (isset($config['pattern'])) {
|
||||
if (isset($config['path'])) {
|
||||
throw new \InvalidArgumentException(sprintf('The file "%s" cannot define both a "path" and a "pattern" attribute. Use only "path".', $path));
|
||||
|
Reference in New Issue
Block a user