Amp\ArtaxTest\ClientHttpBinIntegrationTest::testFileBodyRequest PHP Method

testFileBodyRequest() public method

public testFileBodyRequest ( )
    public function testFileBodyRequest()
    {
        $uri = 'http://httpbin.org/post';
        $client = new Client();
        $bodyPath = __DIR__ . '/fixture/answer.txt';
        $body = new FileBody($bodyPath);
        $request = (new Request())->setBody($body)->setUri($uri)->setMethod('POST');
        $promise = $client->request($request);
        $response = \Amp\wait($promise);
        $this->assertInstanceOf('Amp\\Artax\\Response', $response);
        $result = json_decode($response->getBody(), true);
        $this->assertEquals(file_get_contents($bodyPath), $result['data']);
    }