$provider =
$this->
createProvider(httpClient:
(new MockHttpClient($responses))->
withOptions([ 'base_uri' => 'https://api.phrase.com/api/v2/projects/1/',
'headers' =>
[ 'Authorization' => 'token API_TOKEN',
'User-Agent' => 'myProject',
],
]), endpoint: 'api.phrase.com/api/v2'
);
$translatorBag =
$provider->
read([$domain],
[$locale]);
$this->
assertSame($expectedTranslatorBag->
getCatalogues(),
$translatorBag->
getCatalogues());
} /**
* @dataProvider readProvider
*/
public function testReadCached(string
$locale, string
$localeId, string
$domain, string
$responseContent, TranslatorBag
$expectedTranslatorBag) { $item =
$this->
createMock(CacheItemInterface::
class);
$item->
expects(self::
once())->
method('isHit'
)->
willReturn(true
);
$cachedResponse =
['etag' => 'W/"625d11cf081b1697cbc216edf6ebb13c"', 'modified' => 'Wed, 28 Dec 2022 13:16:45 GMT', 'content' =>
$responseContent];