Skip to content

Commit b719221

Browse files
Merge branch '3.4' into 4.2
* 3.4: fix translating file validation error message [Validator] Add missing Hungarian translations [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 fix horizontal spacing of inlined Bootstrap forms [Translator] Warm up the translations cache in dev turn failed file uploads into form errors
2 parents e607a7f + 2f2ebf4 commit b719221

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
@@ -25,9 +25,9 @@
2525
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
2626
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2727
use Symfony\Component\DependencyInjection\Reference;
28+
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
2829
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic;
2930
use Symfony\Component\DependencyInjection\TypedReference;
30-
use Symfony\Component\HttpKernel\HttpKernelInterface;
3131

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

@@ -547,13 +547,17 @@ public function testSetterInjection()
547547
);
548548
}
549549

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

554-
$definition = $container->register(HttpKernelInterface::class, HttpKernelInterface::class)->setAutowired(true);
558+
$definition = $container->register(CaseSensitiveClass::class, CaseSensitiveClass::class)->setAutowired(true);
555559
$definition->addMethodCall('setLogger');
556-
$this->expectException(RuntimeException::class);
560+
557561
(new ResolveClassPass())->process($container);
558562
(new AutowireRequiredMethodsPass())->process($container);
559563
(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)