@@ -51,11 +51,11 @@ public function testConstructorEmptyArray()
51
51
public function testCreateNewCatalogue ()
52
52
{
53
53
$ writer = $ this ->getMockBuilder (TranslationWriter::class)
54
- ->setMethods ([' writeTranslations ' ])
54
+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
55
55
->disableOriginalConstructor ()
56
56
->getMock ();
57
57
$ writer ->expects ($ this ->once ())
58
- ->method (' writeTranslations ' )
58
+ ->method ($ this -> getMethodNameToWriteTranslations () )
59
59
->with (
60
60
$ this ->isInstanceOf (MessageCatalogueInterface::class),
61
61
'xlf ' ,
@@ -66,11 +66,11 @@ public function testCreateNewCatalogue()
66
66
$ storage ->create (new Message ('key ' , 'domain ' , 'en ' , 'Message ' ));
67
67
68
68
$ writer = $ this ->getMockBuilder (TranslationWriter::class)
69
- ->setMethods ([' writeTranslations ' ])
69
+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
70
70
->disableOriginalConstructor ()
71
71
->getMock ();
72
72
$ writer ->expects ($ this ->once ())
73
- ->method (' writeTranslations ' )
73
+ ->method ($ this -> getMethodNameToWriteTranslations () )
74
74
->with (
75
75
$ this ->isInstanceOf (MessageCatalogueInterface::class),
76
76
'format ' ,
@@ -84,11 +84,11 @@ public function testCreateNewCatalogue()
84
84
public function testCreateExistingCatalogue ()
85
85
{
86
86
$ writer = $ this ->getMockBuilder (TranslationWriter::class)
87
- ->setMethods ([' writeTranslations ' ])
87
+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
88
88
->disableOriginalConstructor ()
89
89
->getMock ();
90
90
$ writer ->expects ($ this ->once ())
91
- ->method (' writeTranslations ' )
91
+ ->method ($ this -> getMethodNameToWriteTranslations () )
92
92
->with (
93
93
$ this ->isInstanceOf (MessageCatalogueInterface::class),
94
94
'xlf ' ,
@@ -127,11 +127,11 @@ public function testGet()
127
127
public function testUpdate ()
128
128
{
129
129
$ writer = $ this ->getMockBuilder (TranslationWriter::class)
130
- ->setMethods ([' writeTranslations ' ])
130
+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
131
131
->disableOriginalConstructor ()
132
132
->getMock ();
133
133
$ writer ->expects ($ this ->exactly (2 ))
134
- ->method (' writeTranslations ' )
134
+ ->method ($ this -> getMethodNameToWriteTranslations () )
135
135
->with (
136
136
$ this ->isInstanceOf (MessageCatalogueInterface::class),
137
137
'xlf ' ,
@@ -149,12 +149,12 @@ public function testUpdate()
149
149
public function testDelete ()
150
150
{
151
151
$ writer = $ this ->getMockBuilder (TranslationWriter::class)
152
- ->setMethods ([' writeTranslations ' ])
152
+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
153
153
->disableOriginalConstructor ()
154
154
->getMock ();
155
155
156
156
$ writer ->expects ($ this ->once ())
157
- ->method (' writeTranslations ' )
157
+ ->method ($ this -> getMethodNameToWriteTranslations () )
158
158
->with (
159
159
$ this ->callback (function (MessageCatalogueInterface $ catalogue ) {
160
160
return !$ catalogue ->defines ('test_0 ' , 'messages ' );
@@ -173,12 +173,12 @@ public function testDelete()
173
173
public function testImport ()
174
174
{
175
175
$ writer = $ this ->getMockBuilder (TranslationWriter::class)
176
- ->setMethods ([' writeTranslations ' ])
176
+ ->setMethods ([$ this -> getMethodNameToWriteTranslations () ])
177
177
->disableOriginalConstructor ()
178
178
->getMock ();
179
179
180
180
$ writer ->expects ($ this ->once ())
181
- ->method (' writeTranslations ' )
181
+ ->method ($ this -> getMethodNameToWriteTranslations () )
182
182
->with (
183
183
$ this ->callback (function (MessageCatalogueInterface $ catalogue ) {
184
184
return $ catalogue ->defines ('test_4711 ' , 'messages ' );
@@ -235,4 +235,13 @@ private function createTranslationLoader()
235
235
236
236
return new TranslationLoader ();
237
237
}
238
+
239
+ private function getMethodNameToWriteTranslations ()
240
+ {
241
+ if (method_exists (TranslationWriter::class, 'write ' )) {
242
+ return 'write ' ;
243
+ }
244
+
245
+ return 'writeTranslations ' ;
246
+ }
238
247
}
0 commit comments