| Conditions | 1 |
| Paths | 1 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | public function testSetOptions() |
||
| 45 | { |
||
| 46 | $res = fopen('php://memory', 'r+'); |
||
| 47 | |||
| 48 | $this->tr->setOptions([ |
||
| 49 | 'debug' => $res, |
||
| 50 | 'headers' => [ |
||
| 51 | 'User-Agent' => 'Foo', |
||
| 52 | ], |
||
| 53 | ])->translate('hello'); |
||
| 54 | rewind($res); |
||
| 55 | $output = str_replace("\r", '', stream_get_contents($res)); |
||
| 56 | $this->assertContains('User-Agent: Foo', $output); |
||
| 57 | |||
| 58 | GoogleTranslate::trans('world', 'en', null, [ |
||
| 59 | 'debug' => $res, |
||
| 60 | 'headers' => [ |
||
| 61 | 'User-Agent' => 'Bar', |
||
| 62 | ], |
||
| 63 | ]); |
||
| 64 | rewind($res); |
||
| 65 | $output = str_replace("\r", '', stream_get_contents($res)); |
||
| 66 | $this->assertContains('User-Agent: Bar', $output); |
||
| 67 | fclose($res); |
||
| 68 | } |
||
| 69 | } |
||
| 70 |