File tree Expand file tree Collapse file tree 10 files changed +52
-12
lines changed
Bundle/TwigBundle/Tests/DependencyInjection/Compiler
Validator/Resources/translations Expand file tree Collapse file tree 10 files changed +52
-12
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,20 @@ public function testProcessDoesNotDropExistingFileLoaderMethodCalls()
21
21
{
22
22
$ container = new ContainerBuilder ();
23
23
$ container ->setParameter ('kernel.debug ' , false );
24
+ $ container ->setParameter ('kernel.root_dir ' , __DIR__ );
24
25
25
26
$ container ->register ('twig.app_variable ' , '\Symfony\Bridge\Twig\AppVariable ' );
26
27
$ container ->register ('templating ' , '\Symfony\Bundle\TwigBundle\TwigEngine ' );
28
+ $ container ->register ('twig.extension.yaml ' );
29
+ $ container ->register ('twig.extension.debug.stopwatch ' );
30
+ $ container ->register ('twig.extension.expression ' );
27
31
28
32
$ nativeTwigLoader = new Definition ('\Twig_Loader_Filesystem ' );
29
33
$ nativeTwigLoader ->addMethodCall ('addPath ' , array ());
30
34
$ container ->setDefinition ('twig.loader.native_filesystem ' , $ nativeTwigLoader );
31
35
32
36
$ filesystemLoader = new Definition ('\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader ' );
37
+ $ filesystemLoader ->setArguments (array (null , null , null ));
33
38
$ filesystemLoader ->addMethodCall ('addPath ' , array ());
34
39
$ container ->setDefinition ('twig.loader.filesystem ' , $ filesystemLoader );
35
40
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ function () {},
255
255
256
256
// assertEquals() does not like NAN values.
257
257
$ this ->assertEquals ($ array [$ i ][0 ], 'float ' );
258
- $ this ->assertNan ( $ array [$ i ++][1 ]);
258
+ $ this ->assertTrue ( is_nan ( $ array [$ i ++][1 ]) );
259
259
}
260
260
261
261
public function testRecursionInArguments ()
Original file line number Diff line number Diff line change @@ -428,10 +428,11 @@ private static function getResourceMetadataForMethod(\ReflectionMethod $method)
428
428
$ class = false ;
429
429
}
430
430
431
+ $ isVariadic = method_exists ($ parameter , 'isVariadic ' ) && $ parameter ->isVariadic ();
431
432
$ methodArgumentsMetadata [] = array (
432
433
'class ' => $ class ,
433
434
'isOptional ' => $ parameter ->isOptional (),
434
- 'defaultValue ' => $ parameter ->isOptional () ? $ parameter ->getDefaultValue () : null ,
435
+ 'defaultValue ' => ( $ parameter ->isOptional () && ! $ isVariadic ) ? $ parameter ->getDefaultValue () : null ,
435
436
);
436
437
}
437
438
Original file line number Diff line number Diff line change 14
14
use Symfony \Component \DependencyInjection \Compiler \AutowirePass ;
15
15
use Symfony \Component \DependencyInjection \ContainerBuilder ;
16
16
use Symfony \Component \DependencyInjection \Reference ;
17
+ use Symfony \Component \DependencyInjection \Tests \Fixtures \includes \FooVariadic ;
17
18
18
19
/**
19
20
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -35,6 +36,23 @@ public function testProcess()
35
36
$ this ->assertEquals ('foo ' , (string ) $ container ->getDefinition ('bar ' )->getArgument (0 ));
36
37
}
37
38
39
+ /**
40
+ * @requires PHP 5.6
41
+ */
42
+ public function testProcessVariadic ()
43
+ {
44
+ $ container = new ContainerBuilder ();
45
+ $ container ->register ('foo ' , Foo::class);
46
+ $ definition = $ container ->register ('fooVariadic ' , FooVariadic::class);
47
+ $ definition ->setAutowired (true );
48
+
49
+ $ pass = new AutowirePass ();
50
+ $ pass ->process ($ container );
51
+
52
+ $ this ->assertCount (1 , $ container ->getDefinition ('fooVariadic ' )->getArguments ());
53
+ $ this ->assertEquals ('foo ' , (string ) $ container ->getDefinition ('fooVariadic ' )->getArgument (0 ));
54
+ }
55
+
38
56
public function testProcessAutowireParent ()
39
57
{
40
58
$ container = new ContainerBuilder ();
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Symfony \Component \DependencyInjection \Tests \Fixtures \includes ;
4
+
5
+ use Symfony \Component \DependencyInjection \Tests \Compiler \Foo ;
6
+
7
+ class FooVariadic
8
+ {
9
+ public function __construct (Foo $ foo )
10
+ {
11
+ }
12
+
13
+ public function bar (...$ arguments )
14
+ {
15
+ }
16
+ }
Original file line number Diff line number Diff line change @@ -156,14 +156,14 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry()
156
156
*/
157
157
public function testLoadUserByUsernameFailsIfEntryHasNoUidKeyAttribute ()
158
158
{
159
- $ result = $ this ->getMock (CollectionInterface::class);
160
- $ query = $ this ->getMock (QueryInterface::class);
159
+ $ result = $ this ->getMockBuilder (CollectionInterface::class)-> getMock ( );
160
+ $ query = $ this ->getMockBuilder (QueryInterface::class)-> getMock ( );
161
161
$ query
162
162
->expects ($ this ->once ())
163
163
->method ('execute ' )
164
164
->will ($ this ->returnValue ($ result ))
165
165
;
166
- $ ldap = $ this ->getMock (LdapInterface::class);
166
+ $ ldap = $ this ->getMockBuilder (LdapInterface::class)-> getMock ( );
167
167
$ result
168
168
->expects ($ this ->once ())
169
169
->method ('offsetGet ' )
@@ -321,14 +321,14 @@ public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttributeAndWro
321
321
322
322
public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute ()
323
323
{
324
- $ result = $ this ->getMock (CollectionInterface::class);
325
- $ query = $ this ->getMock (QueryInterface::class);
324
+ $ result = $ this ->getMockBuilder (CollectionInterface::class)-> getMock ( );
325
+ $ query = $ this ->getMockBuilder (QueryInterface::class)-> getMock ( );
326
326
$ query
327
327
->expects ($ this ->once ())
328
328
->method ('execute ' )
329
329
->will ($ this ->returnValue ($ result ))
330
330
;
331
- $ ldap = $ this ->getMock (LdapInterface::class);
331
+ $ ldap = $ this ->getMockBuilder (LdapInterface::class)-> getMock ( );
332
332
$ result
333
333
->expects ($ this ->once ())
334
334
->method ('offsetGet ' )
Original file line number Diff line number Diff line change 192
192
</trans-unit >
193
193
<trans-unit id =" 51" >
194
194
<source >No temporary folder was configured in php.ini.</source >
195
- <target >Es wurde kein temporärer Ordner in der php.ini konfiguriert.</target >
195
+ <target >Es wurde kein temporärer Ordner in der php.ini konfiguriert oder der temporäre Ordner existiert nicht .</target >
196
196
</trans-unit >
197
197
<trans-unit id =" 52" >
198
198
<source >Cannot write temporary file to disk.</source >
Original file line number Diff line number Diff line change 192
192
</trans-unit >
193
193
<trans-unit id =" 51" >
194
194
<source >No temporary folder was configured in php.ini.</source >
195
- <target >No temporary folder was configured in php.ini.</target >
195
+ <target >No temporary folder was configured in php.ini, or the configured folder does not exist .</target >
196
196
</trans-unit >
197
197
<trans-unit id =" 52" >
198
198
<source >Cannot write temporary file to disk.</source >
Original file line number Diff line number Diff line change 192
192
</trans-unit >
193
193
<trans-unit id =" 51" >
194
194
<source >No temporary folder was configured in php.ini.</source >
195
- <target >Er is geen tijdelijke map geconfigureerd in php.ini.</target >
195
+ <target >Er is geen tijdelijke map geconfigureerd in php.ini, of de gespecificeerde map bestaat niet .</target >
196
196
</trans-unit >
197
197
<trans-unit id =" 52" >
198
198
<source >Cannot write temporary file to disk.</source >
Original file line number Diff line number Diff line change 192
192
</trans-unit >
193
193
<trans-unit id =" 51" >
194
194
<source >No temporary folder was configured in php.ini.</source >
195
- <target >Nie skonfigurowano folderu tymczasowego w php.ini.</target >
195
+ <target >Nie skonfigurowano folderu tymczasowego w php.ini, lub skonfigurowany folder nie istnieje .</target >
196
196
</trans-unit >
197
197
<trans-unit id =" 52" >
198
198
<source >Cannot write temporary file to disk.</source >
You can’t perform that action at this time.
0 commit comments