Skip to content

Commit a0d286d

Browse files
Merge branch '4.2'
* 4.2: fix translating file validation error message [Validator] Add missing Hungarian translations Improving deprecation message of the Twig templates directory src/Resources/views [3.4] [Validator] Add missing french validation translations. [Validator] Only traverse arrays that are cascaded into Handle case where no translations were found [Validator] Translate unique collection message to Hungarian fix tests Run test in separate process Use a class name that does not actually exist [Profiler] Fix dark theme elements color fix horizontal spacing of inlined Bootstrap forms [Translator] Warm up the translations cache in dev turn failed file uploads into form errors
2 parents 0dd2947 + b719221 commit a0d286d

File tree

2 files changed

+12
-31
lines changed

2 files changed

+12
-31
lines changed

Tests/Compiler/AutowirePassTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
2525
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2626
use Symfony\Component\DependencyInjection\Reference;
27+
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
2728
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic;
2829
use Symfony\Component\DependencyInjection\TypedReference;
29-
use Symfony\Component\HttpKernel\HttpKernelInterface;
3030

3131
require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php';
3232

@@ -546,13 +546,17 @@ public function testSetterInjection()
546546
);
547547
}
548548

549+
/**
550+
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
551+
* @exceptedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "setLogger()" does not exist.
552+
*/
549553
public function testWithNonExistingSetterAndAutowiring()
550554
{
551555
$container = new ContainerBuilder();
552556

553-
$definition = $container->register(HttpKernelInterface::class, HttpKernelInterface::class)->setAutowired(true);
557+
$definition = $container->register(CaseSensitiveClass::class, CaseSensitiveClass::class)->setAutowired(true);
554558
$definition->addMethodCall('setLogger');
555-
$this->expectException(RuntimeException::class);
559+
556560
(new ResolveClassPass())->process($container);
557561
(new AutowireRequiredMethodsPass())->process($container);
558562
(new AutowirePass())->process($container);

Tests/Compiler/ResolveBindingsPassTest.php

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@
1717
use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass;
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919
use Symfony\Component\DependencyInjection\Definition;
20-
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
2120
use Symfony\Component\DependencyInjection\Reference;
2221
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
2322
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;
2423
use Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists;
2524
use Symfony\Component\DependencyInjection\TypedReference;
26-
use Symfony\Component\HttpKernel\HttpKernelInterface;
2725

2826
require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php';
2927

@@ -115,6 +113,10 @@ public function testScalarSetter()
115113
$this->assertEquals([['setDefaultLocale', ['fr']]], $definition->getMethodCalls());
116114
}
117115

116+
/**
117+
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
118+
* @exceptedExceptionMessage Invalid service "Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy": method "setLogger()" does not exist.
119+
*/
118120
public function testWithNonExistingSetterAndBinding()
119121
{
120122
$container = new ContainerBuilder();
@@ -123,36 +125,11 @@ public function testWithNonExistingSetterAndBinding()
123125
'$c' => (new Definition('logger'))->setFactory('logger'),
124126
];
125127

126-
$definition = $container->register(HttpKernelInterface::class, HttpKernelInterface::class);
127-
$definition->addMethodCall('setLogger');
128-
$definition->setBindings($bindings);
129-
$this->expectException(RuntimeException::class);
130-
131-
$pass = new ResolveBindingsPass();
132-
$pass->process($container);
133-
}
134-
135-
public function testTupleBinding()
136-
{
137-
$container = new ContainerBuilder();
138-
139-
$bindings = [
140-
'$c' => new BoundArgument(new Reference('bar')),
141-
CaseSensitiveClass::class.'$c' => new BoundArgument(new Reference('foo')),
142-
];
143-
144128
$definition = $container->register(NamedArgumentsDummy::class, NamedArgumentsDummy::class);
145-
$definition->addMethodCall('setSensitiveClass');
146-
$definition->addMethodCall('setAnotherC');
129+
$definition->addMethodCall('setLogger');
147130
$definition->setBindings($bindings);
148131

149132
$pass = new ResolveBindingsPass();
150133
$pass->process($container);
151-
152-
$expected = [
153-
['setSensitiveClass', [new Reference('foo')]],
154-
['setAnotherC', [new Reference('bar')]],
155-
];
156-
$this->assertEquals($expected, $definition->getMethodCalls());
157134
}
158135
}

0 commit comments

Comments
 (0)