|
@@ -63,4 +63,19 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|
$this->assertEquals(array('foo' => 'foobar'), $dup->getPathParameters(), '->duplicate() overrides the path parameters if provided');
|
|
$this->assertEquals(array('foo' => 'foobar'), $dup->getPathParameters(), '->duplicate() overrides the path parameters if provided');
|
|
$this->assertEquals('foobar', $dup->getHttpHeader('foo'), '->duplicate() overrides the HTTP header if provided');
|
|
$this->assertEquals('foobar', $dup->getHttpHeader('foo'), '->duplicate() overrides the HTTP header if provided');
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @covers Symfony\Components\RequestHandler\Request::getFormat
|
|
|
|
+ */
|
|
|
|
+ public function testGetFormat()
|
|
|
|
+ {
|
|
|
|
+ $request = new Request();
|
|
|
|
+
|
|
|
|
+ $this->assertEquals(null, $request->getFormat(null), '->getFormat() returns null when mime-type is null');
|
|
|
|
+ $this->assertEquals(null, $request->getFormat('unexistant-mime-type'), '->getFormat() returns null when mime-type is unknown');
|
|
|
|
+ $this->assertEquals('txt', $request->getFormat('text/plain'), '->getFormat() returns correct format when mime-type have one format only');
|
|
|
|
+ $this->assertEquals('js', $request->getFormat('application/javascript'), '->getFormat() returns correct format when format have multiple mime-type (first)');
|
|
|
|
+ $this->assertEquals('js', $request->getFormat('application/x-javascript'), '->getFormat() returns correct format when format have multiple mime-type');
|
|
|
|
+ $this->assertEquals('js', $request->getFormat('text/javascript'), '->getFormat() returns correct format when format have multiple mime-type (last)');
|
|
|
|
+ }
|
|
}
|
|
}
|