Stichoza\GoogleTranslate\Tests\UtilityTest::testSetHttpOption PHP Метод

testSetHttpOption() публичный Метод

public testSetHttpOption ( )
    public function testSetHttpOption()
    {
        $res = fopen('php://memory', 'r+');
        $this->tr->setHttpOption(['debug' => $res, 'headers' => ['User-Agent' => 'Foo']])->translate('hello');
        rewind($res);
        $output = str_replace("\r", '', stream_get_contents($res));
        $this->assertContains('User-Agent: Foo', $output);
        $this->tr->setHttpOption(['debug' => $res, 'headers' => ['User-Agent' => 'Bar']])->translate('world');
        rewind($res);
        $output = str_replace("\r", '', stream_get_contents($res));
        $this->assertContains('User-Agent: Bar', $output);
        fclose($res);
    }