1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Test\FlexiPeeHP; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2017-06-25 at 23:33:48. |
7
|
|
|
*/ |
8
|
|
|
class FormatsTest extends \PHPUnit_Framework_TestCase |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var Formats |
12
|
|
|
*/ |
13
|
|
|
protected $object; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Sets up the fixture, for example, opens a network connection. |
17
|
|
|
* This method is called before a test is executed. |
18
|
|
|
*/ |
19
|
|
|
protected function setUp() |
20
|
|
|
{ |
21
|
|
|
$this->object = new \FlexiPeeHP\Formats(); |
|
|
|
|
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Tears down the fixture, for example, closes a network connection. |
26
|
|
|
* This method is called after a test is executed. |
27
|
|
|
*/ |
28
|
|
|
protected function tearDown() |
29
|
|
|
{ |
30
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @covers FlexiPeeHP\Formats::byContentType |
35
|
|
|
*/ |
36
|
|
|
public function testByContentType() |
37
|
|
|
{ |
38
|
|
|
$contentTypes = \FlexiPeeHP\Formats::byContentType(); |
39
|
|
|
$this->assertEquals('application/javascript', key($contentTypes)); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @covers FlexiPeeHP\Formats::bySuffix |
44
|
|
|
*/ |
45
|
|
|
public function testBySuffix() |
46
|
|
|
{ |
47
|
|
|
$suffixes = \FlexiPeeHP\Formats::bySuffix(); |
48
|
|
|
$this->assertEquals('js', key($suffixes)); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @covers FlexiPeeHP\Formats::suffixToContentType |
53
|
|
|
*/ |
54
|
|
|
public function testSuffixToContentType() |
55
|
|
|
{ |
56
|
|
|
$this->assertEquals('application/pdf', |
57
|
|
|
\FlexiPeeHP\Formats::suffixToContentType('pdf')); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @covers FlexiPeeHP\Formats::contentTypeToSuffix |
62
|
|
|
*/ |
63
|
|
|
public function testContentTypeToSuffix() |
64
|
|
|
{ |
65
|
|
|
$this->assertEquals('text/csv', |
66
|
|
|
\FlexiPeeHP\Formats::suffixToContentType('csv')); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..