Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
10 | public function testSuccessfulTranslate() |
||
11 | { |
||
12 | $client = new Client(); |
||
13 | |||
14 | $content = GuzzleHttp\Stream\Stream::factory('{"access_token":"123"}'); |
||
15 | |||
16 | $mock = new Mock([ |
||
17 | new Response(200, [], $content), |
||
18 | new Response(200, [], GuzzleHttp\Stream\Stream::factory('<string>Hallo</string>')), |
||
19 | ]); |
||
20 | |||
21 | $client->getEmitter()->attach($mock); |
||
22 | |||
23 | $translator = new \badams\MicrosoftTranslator\MicrosoftTranslator($client); |
||
24 | $translator->setClient('client_id', 'client_secret'); |
||
25 | |||
26 | $this->assertEquals('Hallo', $translator->translate('Hello', 'de', 'en')); |
||
27 | } |
||
28 | |||
29 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.