Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | public function test() |
||
10 | { |
||
11 | $count = 0; |
||
12 | $inc = memoize(function ($n) use (&$count) { |
||
13 | $count += 1; |
||
14 | return $n + 1; |
||
15 | }); |
||
16 | |||
17 | $this->assertEquals($inc(-1), 0); |
||
18 | $this->assertEquals($inc(-1), 0); |
||
19 | $this->assertEquals($inc(-1), 0); |
||
20 | $this->assertEquals($count, 1); |
||
21 | } |
||
22 | } |
||
23 |