Total Complexity | 4 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class ToStringTest extends \CommonTestClass |
||
11 | { |
||
12 | /** |
||
13 | * @param mixed $ext |
||
14 | * @param string $result |
||
15 | * @throws FilesException |
||
16 | * @dataProvider filterDataProvider |
||
17 | */ |
||
18 | public function testSimple($ext, string $result): void |
||
19 | { |
||
20 | $lib = new XToString(); |
||
21 | $this->assertEquals($result, $lib->toStr($ext)); |
||
22 | } |
||
23 | |||
24 | public function filterDataProvider(): array |
||
25 | { |
||
26 | $stream1 = fopen('php://memory', 'r+'); |
||
27 | fwrite($stream1,'Just for unable read'); |
||
28 | return [ |
||
29 | [$stream1, 'Just for unable read'], |
||
30 | ['there is no string', 'there is no string'], |
||
31 | [123456, '123456'], |
||
32 | [123.456, '123.456'], |
||
33 | [new StrObj(), 'test'], |
||
34 | ]; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param mixed $ext |
||
39 | * @throws FilesException |
||
40 | * @dataProvider dieProvider |
||
41 | */ |
||
42 | public function testDie($ext): void |
||
47 | } |
||
48 | |||
49 | public function dieProvider(): array |
||
56 | ]; |
||
57 | } |
||
58 | } |
||
83 | } |