Skip to content

Commit b7c059d

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: [Serializer] Improve exception message in UnwrappingDenormalizer [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 Return false in isTtySupported() when open_basedir restrictions prevent access to /dev/tty. Remove calls to `TestCase::iniSet()` and calls to deprecated methods of `MockBuilder` [PhpUnitBridge] Fix `DeprecationErrorHandler` with PhpUnit 10
2 parents ecf999c + c10a0f3 commit b7c059d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Test/Traits/RuntimeLoaderProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ trait RuntimeLoaderProvider
2020
protected function registerTwigRuntimeLoader(Environment $environment, FormRenderer $renderer)
2121
{
2222
$loader = $this->createMock(RuntimeLoaderInterface::class);
23-
$loader->expects($this->any())->method('load')->will($this->returnValueMap([
23+
$loader->expects($this->any())->method('load')->willReturnMap([
2424
['Symfony\Component\Form\FormRenderer', $renderer],
25-
]));
25+
]);
2626
$environment->addRuntimeLoader($loader);
2727
}
2828
}

Tests/Extension/HttpKernelExtensionTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class HttpKernelExtensionTest extends TestCase
3030
{
3131
public function testFragmentWithError()
3232
{
33-
$renderer = $this->getFragmentHandler($this->throwException(new \Exception('foo')));
33+
$renderer = $this->getFragmentHandler(new \Exception('foo'));
3434

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

@@ -39,7 +39,7 @@ public function testFragmentWithError()
3939

4040
public function testRenderFragment()
4141
{
42-
$renderer = $this->getFragmentHandler($this->returnValue(new Response('html')));
42+
$renderer = $this->getFragmentHandler(new Response('html'));
4343

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

@@ -83,11 +83,17 @@ public function testGenerateFragmentUri()
8383
$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'));
8484
}
8585

86-
protected function getFragmentHandler($return)
86+
protected function getFragmentHandler($returnOrException): FragmentHandler
8787
{
8888
$strategy = $this->createMock(FragmentRendererInterface::class);
8989
$strategy->expects($this->once())->method('getName')->willReturn('inline');
90-
$strategy->expects($this->once())->method('render')->will($return);
90+
91+
$mocker = $strategy->expects($this->once())->method('render');
92+
if ($returnOrException instanceof \Exception) {
93+
$mocker->willThrowException($returnOrException);
94+
} else {
95+
$mocker->willReturn($returnOrException);
96+
}
9197

9298
$context = new RequestStack();
9399

0 commit comments

Comments
 (0)