composer update
This commit is contained in:
@@ -16,6 +16,8 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\UriSigner;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\ArrayLoader;
|
||||
|
||||
class HIncludeFragmentRendererTest extends TestCase
|
||||
{
|
||||
@@ -74,7 +76,17 @@ class HIncludeFragmentRendererTest extends TestCase
|
||||
$this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'id' => 'bar', 'attributes' => ['p1' => 'v1', 'p2' => 'v2']])->getContent());
|
||||
}
|
||||
|
||||
public function testRenderWithDefaultText()
|
||||
public function testRenderWithTwigAndDefaultText()
|
||||
{
|
||||
$twig = new Environment($loader = new ArrayLoader());
|
||||
$strategy = new HIncludeFragmentRenderer($twig);
|
||||
$this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'loading...'])->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testRenderWithDefaultTextLegacy()
|
||||
{
|
||||
$engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock();
|
||||
$engine->expects($this->once())
|
||||
@@ -86,17 +98,4 @@ class HIncludeFragmentRendererTest extends TestCase
|
||||
$strategy = new HIncludeFragmentRenderer($engine);
|
||||
$this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent());
|
||||
}
|
||||
|
||||
public function testRenderWithEngineAndDefaultText()
|
||||
{
|
||||
$engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock();
|
||||
$engine->expects($this->once())
|
||||
->method('exists')
|
||||
->with('loading...')
|
||||
->willThrowException(new \RuntimeException());
|
||||
|
||||
// only default
|
||||
$strategy = new HIncludeFragmentRenderer($engine);
|
||||
$this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'loading...'])->getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class InlineFragmentRendererTest extends TestCase
|
||||
{
|
||||
@@ -72,7 +74,7 @@ class InlineFragmentRendererTest extends TestCase
|
||||
*/
|
||||
public function testRenderExceptionNoIgnoreErrors()
|
||||
{
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
|
||||
$dispatcher->expects($this->never())->method('dispatch');
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernel($this->throwException(new \RuntimeException('foo'))), $dispatcher);
|
||||
@@ -82,12 +84,16 @@ class InlineFragmentRendererTest extends TestCase
|
||||
|
||||
public function testRenderExceptionIgnoreErrors()
|
||||
{
|
||||
$dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
|
||||
$dispatcher->expects($this->once())->method('dispatch')->with(KernelEvents::EXCEPTION);
|
||||
$exception = new \RuntimeException('foo');
|
||||
$kernel = $this->getKernel($this->throwException($exception));
|
||||
$request = Request::create('/');
|
||||
$expectedEvent = new ExceptionEvent($kernel, $request, $kernel::SUB_REQUEST, $exception);
|
||||
$dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
|
||||
$dispatcher->expects($this->once())->method('dispatch')->with($expectedEvent, KernelEvents::EXCEPTION);
|
||||
|
||||
$strategy = new InlineFragmentRenderer($this->getKernel($this->throwException(new \RuntimeException('foo'))), $dispatcher);
|
||||
$strategy = new InlineFragmentRenderer($kernel, $dispatcher);
|
||||
|
||||
$this->assertEmpty($strategy->render('/', Request::create('/'), ['ignore_errors' => true])->getContent());
|
||||
$this->assertEmpty($strategy->render('/', $request, ['ignore_errors' => true])->getContent());
|
||||
}
|
||||
|
||||
public function testRenderExceptionIgnoreErrorsWithAlt()
|
||||
|
||||
Reference in New Issue
Block a user