Merge branch '4.0'

* 4.0:
  [Routing] Fix tests
  [SecurityBundle] fix test by always disabling CSRF
  [FrameworkBundle] remove esi/ssi renderers if inactive
This commit is contained in:
Nicolas Grekas 2017-12-14 23:39:41 +01:00
commit b286950cc4
4 changed files with 19 additions and 3 deletions

View File

@ -143,6 +143,14 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertFalse($container->hasDefinition('fragment.renderer.esi'), 'The ESI fragment renderer is not registered');
}
public function testEsiInactive()
{
$container = $this->createContainerFromFile('default_config');
$this->assertFalse($container->hasDefinition('fragment.renderer.esi'));
$this->assertFalse($container->hasDefinition('esi'));
}
public function testSsi()
{
$container = $this->createContainerFromFile('full');
@ -167,6 +175,14 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertTrue($container->hasDefinition('fragment.renderer.ssi'), 'The SSI fragment renderer is registered');
}
public function testSsiInactive()
{
$container = $this->createContainerFromFile('default_config');
$this->assertFalse($container->hasDefinition('fragment.renderer.ssi'));
$this->assertFalse($container->hasDefinition('ssi'));
}
public function testEnabledProfiler()
{
$container = $this->createContainerFromFile('profiler');

View File

@ -121,7 +121,7 @@ class AddSessionDomainConstraintPassTest extends TestCase
);
$ext = new FrameworkExtension();
$ext->load(array(), $container);
$ext->load(array('framework' => array('csrf_protection' => false)), $container);
$ext = new SecurityExtension();
$ext->load($config, $container);

View File

@ -76,7 +76,7 @@ class PhpMatcherDumperTest extends TestCase
->setConstructorArgs(array(new RequestContext()))
->getMock();
$matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo');
$matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/', 'foo')->willReturn(array());
$matcher->match('/foo%3Abar');
}

View File

@ -105,7 +105,7 @@ class RedirectableUrlMatcherTest extends TestCase
$coll->add('foo', new Route('/foo:bar/'));
$matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
$matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/');
$matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/')->willReturn(array());
$matcher->match('/foo%3Abar');
}
}