InterNations\Component\HttpMock\Tests\PHPUnit\HttpMockMultiPHPUnitIntegrationTest::testSimpleRequest PHP Method

testSimpleRequest() public method

public testSimpleRequest ( $path )
    public function testSimpleRequest($path)
    {
        $this->http['firstNamedServer']->mock->when()->pathIs($path)->then()->body($path . ' body')->end();
        $this->http['firstNamedServer']->setUp();
        $this->assertSame($path . ' body', (string) $this->http['firstNamedServer']->client->get($path)->send()->getBody());
        $request = $this->http['firstNamedServer']->requests->latest();
        $this->assertSame('GET', $request->getMethod());
        $this->assertSame($path, $request->getPath());
        $request = $this->http['firstNamedServer']->requests->last();
        $this->assertSame('GET', $request->getMethod());
        $this->assertSame($path, $request->getPath());
        $request = $this->http['firstNamedServer']->requests->first();
        $this->assertSame('GET', $request->getMethod());
        $this->assertSame($path, $request->getPath());
        $request = $this->http['firstNamedServer']->requests->at(0);
        $this->assertSame('GET', $request->getMethod());
        $this->assertSame($path, $request->getPath());
        $request = $this->http['firstNamedServer']->requests->pop();
        $this->assertSame('GET', $request->getMethod());
        $this->assertSame($path, $request->getPath());
        $this->assertSame($path . ' body', (string) $this->http['firstNamedServer']->client->get($path)->send()->getBody());
        $request = $this->http['firstNamedServer']->requests->shift();
        $this->assertSame('GET', $request->getMethod());
        $this->assertSame($path, $request->getPath());
        $this->setExpectedException('UnexpectedValueException', 'Expected status code 200 from "/_request/last", got 404');
        $this->http['firstNamedServer']->requests->pop();
    }