Completed
Pull Request — master (#294)
by
unknown
03:26
created

IteratorReaderTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetFields() 0 20 1
1
<?php
2
3
namespace Ddeboer\DataImport\Tests\Reader;
4
5
use Ddeboer\DataImport\Reader\IteratorReader;
6
7
/**
8
 * @author Márk Sági-Kazár <[email protected]>
9
 */
10
class IteratorReaderTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function testGetFields()
13
    {
14
        $iterator = new \ArrayIterator([
15
            [
16
                'id'       => 1,
17
                'username' => 'john.doe',
18
                'name'     => 'John Doe',
19
            ],
20
        ]);
21
22
        $reader = new IteratorReader($iterator);
23
24
        // We need to rewind the iterator
25
        $reader->rewind();
26
27
        $fields = $reader->getFields();
28
29
        $this->assertInternalType('array', $fields);
30
        $this->assertEquals(['id', 'username', 'name'], $fields);
31
    }
32
}
33