Conditions | 1 |
Paths | 1 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function filter() |
||
21 | { |
||
22 | $filters = [ |
||
23 | 'foo' => [['string']], |
||
24 | 'date' => [['formatDate', 'Y-m-d']], |
||
25 | 'bool' => [['boolToString']], |
||
26 | ]; |
||
27 | |||
28 | $now = new \DateTime(); |
||
29 | |||
30 | list($success, $filteredInput, $error) = Filterer::filter( |
||
31 | $filters, |
||
32 | [ |
||
33 | 'foo' => 'bar', |
||
34 | 'date' => $now, |
||
35 | 'bool' => true, |
||
36 | ] |
||
37 | ); |
||
38 | $this->assertTrue($success); |
||
39 | $this->assertSame('bar', $filteredInput['foo']); |
||
40 | $this->assertSame($now->format('Y-m-d'), $filteredInput['date']); |
||
41 | $this->assertSame('true', $filteredInput['bool']); |
||
42 | $this->assertNull($error); |
||
43 | } |
||
44 | } |
||
45 |