/** * Tests whether __construct() sets provided values correctly. * * @return void */ public function testConstructWithOptionalParameters() { $request = new HttpRequest(new Uri('http://example.com/foo'), HttpRequest::METHOD_POST, AbstractHttpMessage::HTTP_VERSION_1_0, array(new GenericHeaderField('X-Test', 'Foo')), array('a' => '1'), array('b' => '2'), array(new HttpCookie('test'))); $this->assertSame('', $request->getContent()); $this->assertSame('text/plain; charset=utf-8', $request->getContentType()->toString()); $this->assertFalse($request->getContentType()->hasBinaryContent()); $this->assertSame('X-Test: Foo', $request->getHeaderFields()->get('x-test')->toString()); $this->assertTrue($request->getCookies()->containsKey('test')); $this->assertSame('1', $request->getQueryParameters()->get('a')); $this->assertSame(array('b' => '2'), $request->getPostParameters()->toArray()); $this->assertSame('http://example.com/foo', $request->getUri()->toString()); $this->assertSame(HttpRequest::METHOD_POST, $request->getMethod()); }