@@ -56,4 +56,37 @@ public function testGettersSetters()
5656 $ translations ->setHeader ('POT-Creation-Date ' , '2012-08-07 13:03+0100 ' );
5757 $ this ->assertEquals ('2012-08-07 13:03+0100 ' , $ translations ->getHeader ('POT-Creation-Date ' ));
5858 }
59+
60+ public function testMergeDefault ()
61+ {
62+ $ translations1 = Gettext \Extractors \Po::fromFile (__DIR__ .'/files/po.po ' );
63+ $ translations2 = Gettext \Extractors \Po::fromFile (__DIR__ .'/files/plurals.po ' );
64+
65+ $ this ->assertCount (9 , $ translations1 );
66+ $ this ->assertCount (3 , $ translations2 );
67+
68+ $ translations1 ->mergeWith ($ translations2 );
69+
70+ $ this ->assertCount (12 , $ translations1 );
71+ }
72+
73+ public function testMergeAddRemove ()
74+ {
75+ $ translations1 = Gettext \Extractors \Po::fromFile (__DIR__ .'/files/po.po ' );
76+ $ translations2 = Gettext \Extractors \Po::fromFile (__DIR__ .'/files/plurals.po ' );
77+
78+ $ translations1 ->mergeWith ($ translations2 , Gettext \Translations::MERGE_REMOVE | Gettext \Translations::MERGE_ADD );
79+
80+ $ this ->assertCount (3 , $ translations1 );
81+ }
82+
83+ public function testMergeRemove ()
84+ {
85+ $ translations1 = Gettext \Extractors \Po::fromFile (__DIR__ .'/files/po.po ' );
86+ $ translations2 = Gettext \Extractors \Po::fromFile (__DIR__ .'/files/plurals.po ' );
87+
88+ $ translations1 ->mergeWith ($ translations2 , Gettext \Translations::MERGE_REMOVE );
89+
90+ $ this ->assertCount (0 , $ translations1 );
91+ }
5992}
0 commit comments