ServiceReaderTest::read()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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