ArrayInputTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 45
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testKey() 0 6 1
A testValid() 0 6 1
A testGet() 0 9 1
A testReset() 0 10 1
1
<?php
2
3
namespace Maketok\DataMigration\Input;
4
5
class ArrayInputTest extends \PHPUnit_Framework_TestCase
6
{
7
    /** @var  ArrayInput */
8
    private $input;
9
10
    public function setUp()
11
    {
12
        $this->input = new ArrayInput();
13
    }
14
15
    public function testKey()
16
    {
17
        $this->assertSame(0, $this->input->key());
18
        $this->input->next();
19
        $this->assertSame(1, $this->input->key());
20
    }
21
22
    public function testValid()
23
    {
24
        $this->assertFalse($this->input->valid());
25
        $this->input->add(['1']);
26
        $this->assertTrue($this->input->valid());
27
    }
28
29
    public function testGet()
30
    {
31
        $this->input->add([1,2]);
32
        $this->input->add([2,3]);
33
34
        $this->assertSame([1,2], $this->input->get());
35
        $this->assertSame([2,3], $this->input->get());
36
        $this->assertSame(false, $this->input->get());
37
    }
38
39
    public function testReset()
40
    {
41
        $this->input->add([1,2]);
42
43
        $this->assertSame([1,2], $this->input->get());
44
        $this->assertSame(false, $this->input->get());
45
        $this->input->reset();
46
        $this->assertSame([1,2], $this->input->get());
47
        $this->assertSame(false, $this->input->get());
48
    }
49
}
50