-
Notifications
You must be signed in to change notification settings - Fork 0
/
OptionsTest.php
28 lines (24 loc) · 962 Bytes
/
OptionsTest.php
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
<?php
namespace MockChainTest;
use MockChain\Options;
use MockChain\Sequence;
use PHPUnit\Framework\TestCase;
class OptionsTest extends TestCase
{
public function test()
{
$options = new Options();
$options->add("hello", "goodbye");
$options->add("hola", "chao");
$options->add("multi", (new Sequence())->add('adieu')->add('shalom'));
$this->assertEquals(json_encode($options->options()), json_encode(["hello", "hola", "multi"]));
$this->assertEquals($options->return("hello"), "goodbye");
$this->assertEquals($options->return("hola"), "chao");
$this->assertEquals($options->return("multi"), "adieu");
$this->assertEquals($options->return("multi"), "shalom");
$this->assertEquals($options->return("multi"), "shalom");
$this->assertNull($options->return('not-an-option'));
$options->index(2);
$this->assertEquals(2, $options->getIndex());
}
}