LockingIteratorTest::testWithoutLockerNameMapper()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace itertools;
4
5
use PHPUnit_Framework_TestCase;
6
7
class LockingIteratorTest extends PHPUnit_Framework_TestCase
8
{
9
    /** @test */
10
    public function testWithoutLockerNameMapper()
11
    {
12
        $it = new RangeIterator(0, 10);
13
        $sum = 0;
14
        foreach (new LockingIterator($it, sys_get_temp_dir()) as $v) {
15
            $sum += $v;
16
        }
17
        $this->assertEquals(55, $sum);
18
    }
19
20
    /** @test */
21
    public function testWithLockerNameMapper()
22
    {
23
        $it = new RangeIterator(0, 10);
24
        $sum = 0;
25
        foreach (new LockingIterator($it, sys_get_temp_dir(), function($v) { return 1; }) as $v) {
0 ignored issues
show
Unused Code introduced by
The parameter $v is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
            $sum += $v;
27
        }
28
        $this->assertEquals(55, $sum);
29
    }
30
}
31