@@ -28,28 +28,29 @@ public function setUp()
28
28
29
29
$ factory = new AdapterFactory ($ this ->doctrine , 'EUR ' , array ('EUR ' , 'USD ' ), self ::CURRENCY_ENTITY );
30
30
31
+ $ translator = $ this ->getMock ('Symfony\Component\Translation\TranslatorInterface ' );
32
+ $ translator ->expects ($ this ->any ())
33
+ ->method ('getLocale ' )
34
+ ->will ($ this ->returnValue ('fr ' ));
35
+
31
36
$ converter = new Converter ($ factory ->createDoctrineAdapter ());
32
37
33
38
$ this ->container = new Container ();
34
39
$ this ->container ->set ('lexik_currency.converter ' , $ converter );
35
-
36
- $ this ->translator = $ this ->getMock ('Symfony\Component\Translation\TranslatorInterface ' );
37
- $ this ->translator ->expects ($ this ->any ())
38
- ->method ('getLocale ' )
39
- ->will ($ this ->returnValue ('fr ' ));
40
+ $ this ->container ->set ('translator ' , $ translator );
40
41
}
41
42
42
43
public function testConvert ()
43
44
{
44
- $ extension = new CurrencyExtension ($ this ->translator , $ this -> container );
45
+ $ extension = new CurrencyExtension ($ this ->container );
45
46
46
47
$ this ->assertEquals (11.27 , $ extension ->convert (8.666 , 'USD ' ));
47
48
$ this ->assertEquals (8.67 , $ extension ->convert (8.666 , 'EUR ' ));
48
49
}
49
50
50
51
public function testFormat ()
51
52
{
52
- $ extension = new CurrencyExtension ($ this ->translator , $ this -> container );
53
+ $ extension = new CurrencyExtension ($ this ->container );
53
54
54
55
$ this ->assertEquals ('8,67 € ' , $ extension ->format (8.666 ));
55
56
$ this ->assertEquals ('8,67 € ' , $ extension ->format (8.666 , 'EUR ' ));
@@ -62,7 +63,7 @@ public function testFormat()
62
63
63
64
public function testConvertAndFormat ()
64
65
{
65
- $ extension = new CurrencyExtension ($ this ->translator , $ this -> container );
66
+ $ extension = new CurrencyExtension ($ this ->container );
66
67
67
68
$ this ->assertEquals ('11,27 $ ' , $ extension ->convertAndFormat (8.666 , 'USD ' ));
68
69
$ this ->assertEquals ('11,27 $ ' , $ extension ->convertAndFormat (8.666 , 'USD ' , false ));
0 commit comments