@@ -25,19 +25,34 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
25
25
26
26
public function testDumpMessagesAndClean ()
27
27
{
28
- $ tester = $ this ->createCommandTester ($ this ->getContainer (array ('foo ' => 'foo ' )));
28
+ $ tester = $ this ->createCommandTester ($ this ->getContainer (array ('messages ' => array ( ' foo ' => 'foo ' ) )));
29
29
$ tester ->execute (array ('command ' => 'translation:update ' , 'locale ' => 'en ' , 'bundle ' => 'foo ' , '--dump-messages ' => true , '--clean ' => true ));
30
30
$ this ->assertRegExp ('/foo/ ' , $ tester ->getDisplay ());
31
31
$ this ->assertRegExp ('/2 messages were successfully extracted/ ' , $ tester ->getDisplay ());
32
32
}
33
33
34
+ public function testDumpMessagesForSpecificDomain ()
35
+ {
36
+ $ tester = $ this ->createCommandTester ($ this ->getContainer (array ('messages ' => array ('foo ' => 'foo ' ), 'mydomain ' => array ('bar ' => 'bar ' ))));
37
+ $ tester ->execute (array ('command ' => 'translation:update ' , 'locale ' => 'en ' , 'bundle ' => 'foo ' , '--dump-messages ' => true , '--clean ' => true , '--domain ' => 'mydomain ' ));
38
+ $ this ->assertRegExp ('/bar/ ' , $ tester ->getDisplay ());
39
+ $ this ->assertRegExp ('/2 messages were successfully extracted/ ' , $ tester ->getDisplay ());
40
+ }
41
+
34
42
public function testWriteMessages ()
35
43
{
36
- $ tester = $ this ->createCommandTester ($ this ->getContainer (array ('foo ' => 'foo ' )));
44
+ $ tester = $ this ->createCommandTester ($ this ->getContainer (array ('messages ' => array ( ' foo ' => 'foo ' ) )));
37
45
$ tester ->execute (array ('command ' => 'translation:update ' , 'locale ' => 'en ' , 'bundle ' => 'foo ' , '--force ' => true ));
38
46
$ this ->assertRegExp ('/Translation files were successfully updated./ ' , $ tester ->getDisplay ());
39
47
}
40
48
49
+ public function testWriteMessagesForSpecificDomain ()
50
+ {
51
+ $ tester = $ this ->createCommandTester ($ this ->getContainer (array ('messages ' => array ('foo ' => 'foo ' ), 'mydomain ' => array ('bar ' => 'bar ' ))));
52
+ $ tester ->execute (array ('command ' => 'translation:update ' , 'locale ' => 'en ' , 'bundle ' => 'foo ' , '--force ' => true , '--domain ' => 'mydomain ' ));
53
+ $ this ->assertRegExp ('/Translation files were successfully updated./ ' , $ tester ->getDisplay ());
54
+ }
55
+
41
56
protected function setUp ()
42
57
{
43
58
$ this ->fs = new Filesystem ();
@@ -82,7 +97,9 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
82
97
->method ('extract ' )
83
98
->will (
84
99
$ this ->returnCallback (function ($ path , $ catalogue ) use ($ extractedMessages ) {
85
- $ catalogue ->add ($ extractedMessages );
100
+ foreach ($ extractedMessages as $ domain => $ messages ) {
101
+ $ catalogue ->add ($ messages , $ domain );
102
+ }
86
103
})
87
104
);
88
105
0 commit comments