ServiceReaderTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRead() 0 15 2
A read() 0 4 1
1
<?php
2
namespace Mathielen\DataImport\Reader;
3
4
class ServiceReaderTest extends \PHPUnit_Framework_TestCase
5
{
6
7
    public function testRead()
8
    {
9
        $reader = new ServiceReader(array($this, 'read'));
10
11
        $this->assertEquals(1, count($reader));
12
        $this->assertEquals(array('field1'), $reader->getFields());
13
        $this->assertEquals(array('field1'=>'123'), $reader->current());
14
15
        $actualData = array();
16
        $expectedData = array('key'=>array('field1'=>'123'));
17
        foreach ($reader as $key=>$row) {
18
            $actualData[$key] = $row;
19
        }
20
        $this->assertEquals($expectedData, $actualData);
21
    }
22
23
    public function read()
24
    {
25
        return array('key'=>array('field1'=>'123'));
26
    }
27
28
}
29