@@ -51,11 +51,11 @@ public function testConstructorEmptyArray()
5151 public function testCreateNewCatalogue ()
5252 {
5353 $ writer = $ this ->getMockBuilder (TranslationWriter::class)
54- ->setMethods ([' writeTranslations ' ])
54+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
5555 ->disableOriginalConstructor ()
5656 ->getMock ();
5757 $ writer ->expects ($ this ->once ())
58- ->method (' writeTranslations ' )
58+ ->method ($ this -> getMethodNameToWriteTranslations () )
5959 ->with (
6060 $ this ->isInstanceOf (MessageCatalogueInterface::class),
6161 'xlf ' ,
@@ -66,11 +66,11 @@ public function testCreateNewCatalogue()
6666 $ storage ->create (new Message ('key ' , 'domain ' , 'en ' , 'Message ' ));
6767
6868 $ writer = $ this ->getMockBuilder (TranslationWriter::class)
69- ->setMethods ([' writeTranslations ' ])
69+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
7070 ->disableOriginalConstructor ()
7171 ->getMock ();
7272 $ writer ->expects ($ this ->once ())
73- ->method (' writeTranslations ' )
73+ ->method ($ this -> getMethodNameToWriteTranslations () )
7474 ->with (
7575 $ this ->isInstanceOf (MessageCatalogueInterface::class),
7676 'format ' ,
@@ -84,11 +84,11 @@ public function testCreateNewCatalogue()
8484 public function testCreateExistingCatalogue ()
8585 {
8686 $ writer = $ this ->getMockBuilder (TranslationWriter::class)
87- ->setMethods ([' writeTranslations ' ])
87+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
8888 ->disableOriginalConstructor ()
8989 ->getMock ();
9090 $ writer ->expects ($ this ->once ())
91- ->method (' writeTranslations ' )
91+ ->method ($ this -> getMethodNameToWriteTranslations () )
9292 ->with (
9393 $ this ->isInstanceOf (MessageCatalogueInterface::class),
9494 'xlf ' ,
@@ -127,11 +127,11 @@ public function testGet()
127127 public function testUpdate ()
128128 {
129129 $ writer = $ this ->getMockBuilder (TranslationWriter::class)
130- ->setMethods ([' writeTranslations ' ])
130+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
131131 ->disableOriginalConstructor ()
132132 ->getMock ();
133133 $ writer ->expects ($ this ->exactly (2 ))
134- ->method (' writeTranslations ' )
134+ ->method ($ this -> getMethodNameToWriteTranslations () )
135135 ->with (
136136 $ this ->isInstanceOf (MessageCatalogueInterface::class),
137137 'xlf ' ,
@@ -149,12 +149,12 @@ public function testUpdate()
149149 public function testDelete ()
150150 {
151151 $ writer = $ this ->getMockBuilder (TranslationWriter::class)
152- ->setMethods ([' writeTranslations ' ])
152+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
153153 ->disableOriginalConstructor ()
154154 ->getMock ();
155155
156156 $ writer ->expects ($ this ->once ())
157- ->method (' writeTranslations ' )
157+ ->method ($ this -> getMethodNameToWriteTranslations () )
158158 ->with (
159159 $ this ->callback (function (MessageCatalogueInterface $ catalogue ) {
160160 return !$ catalogue ->defines ('test_0 ' , 'messages ' );
@@ -173,12 +173,12 @@ public function testDelete()
173173 public function testImport ()
174174 {
175175 $ writer = $ this ->getMockBuilder (TranslationWriter::class)
176- ->setMethods ([' writeTranslations ' ])
176+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
177177 ->disableOriginalConstructor ()
178178 ->getMock ();
179179
180180 $ writer ->expects ($ this ->once ())
181- ->method (' writeTranslations ' )
181+ ->method ($ this -> getMethodNameToWriteTranslations () )
182182 ->with (
183183 $ this ->callback (function (MessageCatalogueInterface $ catalogue ) {
184184 return $ catalogue ->defines ('test_4711 ' , 'messages ' );
@@ -235,4 +235,13 @@ private function createTranslationLoader()
235235
236236 return new TranslationLoader ();
237237 }
238+
239+ private function getMethodNameToWriteTranslations ()
240+ {
241+ if (method_exists (TranslationWriter::class, 'write ' )) {
242+ return 'write ' ;
243+ }
244+
245+ return 'writeTranslations ' ;
246+ }
238247}
0 commit comments