Skip to content

Commit c194c0f

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: add validator translation 99 for Italian language stop using the deprecated at() PHPUnit matcher Fix typehint phpdoc
2 parents 79fde10 + 83956b6 commit c194c0f

File tree

1 file changed

+37
-58
lines changed

1 file changed

+37
-58
lines changed

Tests/Translation/TranslatorTest.php

Lines changed: 37 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,18 @@ public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $e
146146

147147
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
148148

149-
$loader->expects($this->at(0))
149+
$loader->expects($this->exactly(2))
150150
->method('load')
151-
/* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
152-
->with('messages.some_locale.loader', 'some_locale', 'messages')
153-
->willReturn($someCatalogue);
154-
155-
$loader->expects($this->at(1))
156-
->method('load')
157-
/* This resource is added by an addResource() call and shall be loaded after the resource_files */
158-
->with('second_resource.some_locale.loader', 'some_locale', 'messages')
159-
->willReturn($someCatalogue);
151+
->withConsecutive(
152+
/* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */
153+
['messages.some_locale.loader', 'some_locale', 'messages'],
154+
/* This resource is added by an addResource() call and shall be loaded after the resource_files */
155+
['second_resource.some_locale.loader', 'some_locale', 'messages']
156+
)
157+
->willReturnOnConsecutiveCalls(
158+
$someCatalogue,
159+
$someCatalogue
160+
);
160161

161162
$options = [
162163
'resource_files' => ['some_locale' => ['messages.some_locale.loader']],
@@ -263,55 +264,33 @@ protected function getLoader()
263264
{
264265
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
265266
$loader
266-
->expects($this->at(0))
267-
->method('load')
268-
->willReturn($this->getCatalogue('fr', [
269-
'foo' => 'foo (FR)',
270-
]))
271-
;
272-
$loader
273-
->expects($this->at(1))
274-
->method('load')
275-
->willReturn($this->getCatalogue('en', [
276-
'foo' => 'foo (EN)',
277-
'bar' => 'bar (EN)',
278-
'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)',
279-
]))
280-
;
281-
$loader
282-
->expects($this->at(2))
283-
->method('load')
284-
->willReturn($this->getCatalogue('es', [
285-
'foobar' => 'foobar (ES)',
286-
]))
287-
;
288-
$loader
289-
->expects($this->at(3))
290-
->method('load')
291-
->willReturn($this->getCatalogue('pt-PT', [
292-
'foobarfoo' => 'foobarfoo (PT-PT)',
293-
]))
294-
;
295-
$loader
296-
->expects($this->at(4))
297-
->method('load')
298-
->willReturn($this->getCatalogue('pt_BR', [
299-
'other choice' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR)',
300-
]))
301-
;
302-
$loader
303-
->expects($this->at(5))
304-
->method('load')
305-
->willReturn($this->getCatalogue('fr.UTF-8', [
306-
'foobarbaz' => 'foobarbaz (fr.UTF-8)',
307-
]))
308-
;
309-
$loader
310-
->expects($this->at(6))
267+
->expects($this->exactly(7))
311268
->method('load')
312-
->willReturn($this->getCatalogue('sr@latin', [
313-
'foobarbax' => 'foobarbax (sr@latin)',
314-
]))
269+
->willReturnOnConsecutiveCalls(
270+
$this->getCatalogue('fr', [
271+
'foo' => 'foo (FR)',
272+
]),
273+
$this->getCatalogue('en', [
274+
'foo' => 'foo (EN)',
275+
'bar' => 'bar (EN)',
276+
'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)',
277+
]),
278+
$this->getCatalogue('es', [
279+
'foobar' => 'foobar (ES)',
280+
]),
281+
$this->getCatalogue('pt-PT', [
282+
'foobarfoo' => 'foobarfoo (PT-PT)',
283+
]),
284+
$this->getCatalogue('pt_BR', [
285+
'other choice' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR)',
286+
]),
287+
$this->getCatalogue('fr.UTF-8', [
288+
'foobarbaz' => 'foobarbaz (fr.UTF-8)',
289+
]),
290+
$this->getCatalogue('sr@latin', [
291+
'foobarbax' => 'foobarbax (sr@latin)',
292+
])
293+
)
315294
;
316295

317296
return $loader;

0 commit comments

Comments
 (0)