forked from php-school/cli-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrameTest.php
More file actions
71 lines (58 loc) · 1.78 KB
/
Copy pathFrameTest.php
File metadata and controls
71 lines (58 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
declare(strict_types=1);
namespace PhpSchool\CliMenuTest;
use PhpSchool\CliMenu\Frame;
use PHPUnit\Framework\TestCase;
/**
* @author Aydin Hassan <[email protected]>
*/
class FrameTest extends TestCase
{
public function testNewLine() : void
{
$frame = new Frame;
$frame->newLine();
$this->assertEquals(["\n"], $frame->getRows());
$frame = new Frame;
$frame->newLine(1);
$this->assertEquals(["\n"], $frame->getRows());
$frame = new Frame;
$frame->newLine(2);
$this->assertEquals(["\n", "\n"], $frame->getRows());
}
public function testAddRows() : void
{
$frame = new Frame;
$frame->addRows(['one', 'two']);
$this->assertEquals(['one', 'two'], $frame->getRows());
$frame->addRows(['three']);
$this->assertEquals(['one', 'two', 'three'], $frame->getRows());
}
public function testAddRow() : void
{
$frame = new Frame;
$frame->addRow('one');
$this->assertEquals(['one'], $frame->getRows());
$frame->addRow('two');
$this->assertEquals(['one', 'two'], $frame->getRows());
}
public function testCount() : void
{
$frame = new Frame;
$frame->addRow('one');
$this->assertEquals(['one'], $frame->getRows());
$this->assertCount(1, $frame);
$frame->addRow('two');
$this->assertEquals(['one', 'two'], $frame->getRows());
$this->assertCount(2, $frame);
}
public function testAll() : void
{
$frame = new Frame;
$frame->addRow('one');
$frame->addRows(["two", "three"]);
$frame->newLine(2);
$this->assertEquals(['one', 'two', 'three', "\n", "\n"], $frame->getRows());
$this->assertCount(5, $frame);
}
}