Skip to content

Commit

Permalink
Unit test for retrieving a media type parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
neoncitylights committed Nov 13, 2020
1 parent c6521e5 commit 57a0178
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/DataUrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ public function testGetMediaTypeEssence( $expectedMediaTypeEssence, $validDataUr
);
}

/**
* @covers ::getMediaType
* @dataProvider provideMediaTypeParameters
*/
public function testGetMediaTypeParameterValue( $expectedParameter, $expectedParameterValue, $validDataUrl ) {
$this->assertEquals(
$expectedParameterValue,
self::$dataUrlParser->parse( $validDataUrl )->getMediaType()->getParameterValue( $expectedParameter )
);
}

/**
* @covers ::getData
* @dataProvider provideData
Expand Down Expand Up @@ -112,6 +123,14 @@ public function provideMediaTypeEssences() {
];
}

public function provideMediaTypeParameters() {
yield [
'charset',
'UTF-8',
'data:text/plain;charset=UTF-8;base64,VGhlIGZpdmUgYm94aW5nIHdpemFyZHMganVtcCBxdWlja2x5Lg=='
];
}

public function provideData() {
yield 'text/plain example #1: hello world: data' => [
"SGVsbG8sIFdvcmxkIQ==",
Expand Down

0 comments on commit 57a0178

Please sign in to comment.