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
|
|
|
|