Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | public function shouldReturnTruncate() |
||
14 | { |
||
15 | $append = function ($x) { |
||
16 | return function ($y) use ($x) { |
||
17 | return $y.$x; |
||
18 | }; |
||
19 | }; |
||
20 | $chunk = function ($str) { |
||
21 | return substr($str, 0, 10); |
||
22 | }; |
||
23 | $pred = function ($str) { |
||
24 | return strlen($str) > 10; |
||
25 | }; |
||
26 | $truncate = when($pred)(pipe($chunk, $append('…'))); |
||
27 | |||
28 | $this->assertEquals('12345', $truncate('12345')); |
||
29 | $this->assertEquals('0123456789…', $truncate('0123456789ABC')); |
||
30 | } |
||
31 | } |
||
32 |