LockingIteratorTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testWithoutLockerNameMapper() 0 9 2
A testWithLockerNameMapper() 0 9 2
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