Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 5.4:
  [PropertyInfo] Update DoctrineExtractor for new DBAL 4 BIGINT type
  Update security.nl.xlf
  [Validator] IBAN Check digits should always between 2 and 98
  [Security] Populate translations for trans-unit 20
  add missing plural translation messages
  filter out empty HTTP header parts
  [String] Fix folded in compat mode
  Remove calls to `getMockForAbstractClass()`
  [ErrorHandler] Do not call xdebug_get_function_stack() with xdebug >= 3.0 when not in develop mode
  [Serializer] Fix type for missing property
  add test for JSON response with null as content
  [Filesystem] Fix dumpFile `stat failed` error hitting custom handler
  Remove calls to `TestCase::iniSet()` and calls to deprecated methods of `MockBuilder`
  [PhpUnitBridge] Fix `DeprecationErrorHandler` with PhpUnit 10
  • Loading branch information
fabpot committed May 17, 2024
2 parents 544e47a + 3f23fba commit 413577f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Test/Traits/RuntimeLoaderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ trait RuntimeLoaderProvider
protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer)
{
$loader = $this->createMock(RuntimeLoaderInterface::class);
$loader->expects($this->any())->method('load')->will($this->returnValueMap([
$loader->expects($this->any())->method('load')->willReturnMap([
['Symfony\Component\Form\FormRenderer', $renderer],
]));
]);
$environment->addRuntimeLoader($loader);
}
}
14 changes: 10 additions & 4 deletions Tests/Extension/HttpKernelExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HttpKernelExtensionTest extends TestCase
{
public function testFragmentWithError()
{
$renderer = $this->getFragmentHandler($this->throwException(new \Exception('foo')));
$renderer = $this->getFragmentHandler(new \Exception('foo'));

$this->expectException(\Twig\Error\RuntimeError::class);

Expand All @@ -39,7 +39,7 @@ public function testFragmentWithError()

public function testRenderFragment()
{
$renderer = $this->getFragmentHandler($this->returnValue(new Response('html')));
$renderer = $this->getFragmentHandler(new Response('html'));

$response = $this->renderTemplate($renderer);

Expand Down Expand Up @@ -84,11 +84,17 @@ public function testGenerateFragmentUri()
$this->assertSame('/_fragment?_hash=PP8%2FeEbn1pr27I9wmag%2FM6jYGVwUZ0l2h0vhh2OJ6CI%3D&_path=template%3Dfoo.html.twig%26_format%3Dhtml%26_locale%3Den%26_controller%3DSymfonyBundleFrameworkBundleControllerTemplateController%253A%253AtemplateAction', $twig->render('index'));
}

protected function getFragmentHandler($return)
protected function getFragmentHandler($returnOrException): FragmentHandler
{
$strategy = $this->createMock(FragmentRendererInterface::class);
$strategy->expects($this->once())->method('getName')->willReturn('inline');
$strategy->expects($this->once())->method('render')->will($return);

$mocker = $strategy->expects($this->once())->method('render');
if ($returnOrException instanceof \Exception) {
$mocker->willThrowException($returnOrException);
} else {
$mocker->willReturn($returnOrException);
}

$context = $this->createMock(RequestStack::class);

Expand Down

0 comments on commit 413577f

Please sign in to comment.