Skip to content

Commit 8723c82

Browse files
committed
Use willReturn() instead of will(returnValue()).
1 parent 3217e57 commit 8723c82

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

Tests/Data/Bundle/Reader/BundleEntryReaderTest.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testForwardCallToRead()
7272
$this->readerImpl->expects($this->once())
7373
->method('read')
7474
->with(self::RES_DIR, 'root')
75-
->will($this->returnValue(self::$data));
75+
->willReturn(self::$data);
7676

7777
$this->assertSame(self::$data, $this->reader->read(self::RES_DIR, 'root'));
7878
}
@@ -82,12 +82,12 @@ public function testReadEntireDataFileIfNoIndicesGiven()
8282
$this->readerImpl->expects($this->at(0))
8383
->method('read')
8484
->with(self::RES_DIR, 'en')
85-
->will($this->returnValue(self::$data));
85+
->willReturn(self::$data);
8686

8787
$this->readerImpl->expects($this->at(1))
8888
->method('read')
8989
->with(self::RES_DIR, 'root')
90-
->will($this->returnValue(self::$fallbackData));
90+
->willReturn(self::$fallbackData);
9191

9292
$this->assertSame(self::$mergedData, $this->reader->readEntry(self::RES_DIR, 'en', []));
9393
}
@@ -97,7 +97,7 @@ public function testReadExistingEntry()
9797
$this->readerImpl->expects($this->once())
9898
->method('read')
9999
->with(self::RES_DIR, 'root')
100-
->will($this->returnValue(self::$data));
100+
->willReturn(self::$data);
101101

102102
$this->assertSame('Bar', $this->reader->readEntry(self::RES_DIR, 'root', ['Entries', 'Foo']));
103103
}
@@ -110,7 +110,7 @@ public function testReadNonExistingEntry()
110110
$this->readerImpl->expects($this->once())
111111
->method('read')
112112
->with(self::RES_DIR, 'root')
113-
->will($this->returnValue(self::$data));
113+
->willReturn(self::$data);
114114

115115
$this->reader->readEntry(self::RES_DIR, 'root', ['Entries', 'NonExisting']);
116116
}
@@ -120,12 +120,12 @@ public function testFallbackIfEntryDoesNotExist()
120120
$this->readerImpl->expects($this->at(0))
121121
->method('read')
122122
->with(self::RES_DIR, 'en_GB')
123-
->will($this->returnValue(self::$data));
123+
->willReturn(self::$data);
124124

125125
$this->readerImpl->expects($this->at(1))
126126
->method('read')
127127
->with(self::RES_DIR, 'en')
128-
->will($this->returnValue(self::$fallbackData));
128+
->willReturn(self::$fallbackData);
129129

130130
$this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam']));
131131
}
@@ -138,7 +138,7 @@ public function testDontFallbackIfEntryDoesNotExistAndFallbackDisabled()
138138
$this->readerImpl->expects($this->once())
139139
->method('read')
140140
->with(self::RES_DIR, 'en_GB')
141-
->will($this->returnValue(self::$data));
141+
->willReturn(self::$data);
142142

143143
$this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam'], false);
144144
}
@@ -153,7 +153,7 @@ public function testFallbackIfLocaleDoesNotExist()
153153
$this->readerImpl->expects($this->at(1))
154154
->method('read')
155155
->with(self::RES_DIR, 'en')
156-
->will($this->returnValue(self::$fallbackData));
156+
->willReturn(self::$fallbackData);
157157

158158
$this->assertSame('Lah', $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Entries', 'Bam']));
159159
}
@@ -193,17 +193,17 @@ public function testMergeDataWithFallbackData($childData, $parentData, $result)
193193
$this->readerImpl->expects($this->at(0))
194194
->method('read')
195195
->with(self::RES_DIR, 'en')
196-
->will($this->returnValue($childData));
196+
->willReturn($childData);
197197

198198
$this->readerImpl->expects($this->at(1))
199199
->method('read')
200200
->with(self::RES_DIR, 'root')
201-
->will($this->returnValue($parentData));
201+
->willReturn($parentData);
202202
} else {
203203
$this->readerImpl->expects($this->once())
204204
->method('read')
205205
->with(self::RES_DIR, 'en')
206-
->will($this->returnValue($childData));
206+
->willReturn($childData);
207207
}
208208

209209
$this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en', [], true));
@@ -217,7 +217,7 @@ public function testDontMergeDataIfFallbackDisabled($childData, $parentData, $re
217217
$this->readerImpl->expects($this->once())
218218
->method('read')
219219
->with(self::RES_DIR, 'en_GB')
220-
->will($this->returnValue($childData));
220+
->willReturn($childData);
221221

222222
$this->assertSame($childData, $this->reader->readEntry(self::RES_DIR, 'en_GB', [], false));
223223
}
@@ -231,17 +231,17 @@ public function testMergeExistingEntryWithExistingFallbackEntry($childData, $par
231231
$this->readerImpl->expects($this->at(0))
232232
->method('read')
233233
->with(self::RES_DIR, 'en')
234-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
234+
->willReturn(['Foo' => ['Bar' => $childData]]);
235235

236236
$this->readerImpl->expects($this->at(1))
237237
->method('read')
238238
->with(self::RES_DIR, 'root')
239-
->will($this->returnValue(['Foo' => ['Bar' => $parentData]]));
239+
->willReturn(['Foo' => ['Bar' => $parentData]]);
240240
} else {
241241
$this->readerImpl->expects($this->once())
242242
->method('read')
243243
->with(self::RES_DIR, 'en')
244-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
244+
->willReturn(['Foo' => ['Bar' => $childData]]);
245245
}
246246

247247
$this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en', ['Foo', 'Bar'], true));
@@ -255,12 +255,12 @@ public function testMergeNonExistingEntryWithExistingFallbackEntry($childData, $
255255
$this->readerImpl->expects($this->at(0))
256256
->method('read')
257257
->with(self::RES_DIR, 'en_GB')
258-
->will($this->returnValue(['Foo' => 'Baz']));
258+
->willReturn(['Foo' => 'Baz']);
259259

260260
$this->readerImpl->expects($this->at(1))
261261
->method('read')
262262
->with(self::RES_DIR, 'en')
263-
->will($this->returnValue(['Foo' => ['Bar' => $parentData]]));
263+
->willReturn(['Foo' => ['Bar' => $parentData]]);
264264

265265
$this->assertSame($parentData, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true));
266266
}
@@ -274,17 +274,17 @@ public function testMergeExistingEntryWithNonExistingFallbackEntry($childData, $
274274
$this->readerImpl->expects($this->at(0))
275275
->method('read')
276276
->with(self::RES_DIR, 'en_GB')
277-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
277+
->willReturn(['Foo' => ['Bar' => $childData]]);
278278

279279
$this->readerImpl->expects($this->at(1))
280280
->method('read')
281281
->with(self::RES_DIR, 'en')
282-
->will($this->returnValue(['Foo' => 'Bar']));
282+
->willReturn(['Foo' => 'Bar']);
283283
} else {
284284
$this->readerImpl->expects($this->once())
285285
->method('read')
286286
->with(self::RES_DIR, 'en_GB')
287-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
287+
->willReturn(['Foo' => ['Bar' => $childData]]);
288288
}
289289

290290
$this->assertSame($childData, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true));
@@ -298,12 +298,12 @@ public function testFailIfEntryFoundNeitherInParentNorChild()
298298
$this->readerImpl->expects($this->at(0))
299299
->method('read')
300300
->with(self::RES_DIR, 'en_GB')
301-
->will($this->returnValue(['Foo' => 'Baz']));
301+
->willReturn(['Foo' => 'Baz']);
302302

303303
$this->readerImpl->expects($this->at(1))
304304
->method('read')
305305
->with(self::RES_DIR, 'en')
306-
->will($this->returnValue(['Foo' => 'Bar']));
306+
->willReturn(['Foo' => 'Bar']);
307307

308308
$this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true);
309309
}
@@ -320,17 +320,17 @@ public function testMergeTraversables($childData, $parentData, $result)
320320
$this->readerImpl->expects($this->at(0))
321321
->method('read')
322322
->with(self::RES_DIR, 'en_GB')
323-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
323+
->willReturn(['Foo' => ['Bar' => $childData]]);
324324

325325
$this->readerImpl->expects($this->at(1))
326326
->method('read')
327327
->with(self::RES_DIR, 'en')
328-
->will($this->returnValue(['Foo' => ['Bar' => $parentData]]));
328+
->willReturn(['Foo' => ['Bar' => $parentData]]);
329329
} else {
330330
$this->readerImpl->expects($this->once())
331331
->method('read')
332332
->with(self::RES_DIR, 'en_GB')
333-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
333+
->willReturn(['Foo' => ['Bar' => $childData]]);
334334
}
335335

336336
$this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', ['Foo', 'Bar'], true));
@@ -347,18 +347,18 @@ public function testFollowLocaleAliases($childData, $parentData, $result)
347347
$this->readerImpl->expects($this->at(0))
348348
->method('read')
349349
->with(self::RES_DIR, 'ro_MD')
350-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
350+
->willReturn(['Foo' => ['Bar' => $childData]]);
351351

352352
// Read fallback locale of aliased locale ("ro_MD" -> "ro")
353353
$this->readerImpl->expects($this->at(1))
354354
->method('read')
355355
->with(self::RES_DIR, 'ro')
356-
->will($this->returnValue(['Foo' => ['Bar' => $parentData]]));
356+
->willReturn(['Foo' => ['Bar' => $parentData]]);
357357
} else {
358358
$this->readerImpl->expects($this->once())
359359
->method('read')
360360
->with(self::RES_DIR, 'ro_MD')
361-
->will($this->returnValue(['Foo' => ['Bar' => $childData]]));
361+
->willReturn(['Foo' => ['Bar' => $childData]]);
362362
}
363363

364364
$this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'mo', ['Foo', 'Bar'], true));

0 commit comments

Comments
 (0)