Skip to content

Commit

Permalink
Add two missing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
franzliedke committed Apr 24, 2018
1 parent fd26c22 commit 71f673d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/FormatNegotiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ public function test_known_mimetypes_will_return_preferred_format($mimeType, $ex
$this->assertEquals($expectedFormat, $format);
}

public function test_multiple_mimetypes_will_prefer_the_first_match()
{
$format = FormatNegotiator::getPreferredFormat(
$this->makeRequestWithAccept('application/xml, application/json')
);

$this->assertEquals('xml', $format);
}

public function test_unknown_mimetypes_will_fall_back_to_plain_text()
{
$format = FormatNegotiator::getPreferredFormat(
$this->makeRequestWithAccept('foo/bar, x/custom')
);

$this->assertEquals('txt', $format);
}

public function knownTypes()
{
return [
Expand Down

0 comments on commit 71f673d

Please sign in to comment.