-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathResultTest.php
More file actions
79 lines (64 loc) · 1.58 KB
/
Copy pathResultTest.php
File metadata and controls
79 lines (64 loc) · 1.58 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
72
73
74
75
76
77
78
79
<?php
use Foolz\Plugin\Result as Result;
class ResultTest extends PHPUnit_Framework_TestCase
{
public function testResult()
{
$std = new stdClass();
$new = new Result(array('param1' => 'test'), $std);
$this->assertSame($std, $new->getObject());
}
public function testSetGet()
{
$new = new Result();
$new->set('bla');
$this->assertSame('bla', $new->get());
}
/**
* @expectedException \OutOfBoundsException
*/
public function testSetGetThrowsOutOfBounds()
{
$new = new Result();
$new->getObject();
}
public function testSetGetFallback()
{
$new = new Result();
$this->assertSame('blabla', $new->get('blabla'));
}
public function testSetGetParam()
{
$arr = array('param1' => 'test', 'param2' => 'testtest');
$new = new Result($arr);
$this->assertSame($arr, $new->getParams());
$this->assertSame('test', $new->getParam('param1'));
$new->setParam('param1', 'test1');
$this->assertSame($arr, $new->getParams(true));
$this->assertSame('test', $new->getParam('param1', true));
$this->assertSame('test1', $new->getParam('param1'));
}
public function testSetGetParams()
{
$arr = array('param1' => 'test', 'param2' => 'testtest');
$new = new Result();
$new->setParams($arr);
$this->assertSame($arr, $new->getParams());
}
/**
* @expectedException \OutOfBoundsException
*/
public function testGetParamThrowsOutOfBounds()
{
$new = new Result();
$new->getParam('herp');
}
/**
* @expectedException \OutOfBoundsException
*/
public function testGetParamOrigThrowsOutOfBounds()
{
$new = new Result();
$new->getParam('herp', true);
}
}