| @@ 18-26 (lines=9) @@ | ||
| 15 | { |
|
| 16 | } |
|
| 17 | ||
| 18 | public function testConstructorOk1() |
|
| 19 | { |
|
| 20 | $fields = array( |
|
| 21 | 'question1' => 'answer1', |
|
| 22 | 'question2' => 'answer2', |
|
| 23 | ); |
|
| 24 | $arrayList = new StorageArray($fields, true); |
|
| 25 | $this->assertEquals($fields, $arrayList->toArray()); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testConstructorOk2() |
|
| 29 | { |
|
| @@ 38-46 (lines=9) @@ | ||
| 35 | /** |
|
| 36 | * @expectedException \Brownie\Util\Exception\UndefinedMethodException |
|
| 37 | */ |
|
| 38 | public function testConstructorError() |
|
| 39 | { |
|
| 40 | $fields = array( |
|
| 41 | 'question1' => 'answer1', |
|
| 42 | 'question2' => 'answer2', |
|
| 43 | ); |
|
| 44 | $arrayList = new StorageArray($fields); |
|
| 45 | $this->assertEquals($fields, $arrayList->toArray()); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function testSetGetOk() |
|
| 49 | { |
|
| @@ 65-74 (lines=10) @@ | ||
| 62 | /** |
|
| 63 | * @expectedException \Brownie\Util\Exception\UndefinedMethodException |
|
| 64 | */ |
|
| 65 | public function testSetError() |
|
| 66 | { |
|
| 67 | $fields = array( |
|
| 68 | 'question1' => 'answer1', |
|
| 69 | 'question2' => 'answer2', |
|
| 70 | ); |
|
| 71 | $arrayList = new StorageArray($fields, true); |
|
| 72 | $arrayList->setQuestion3('answer3'); |
|
| 73 | $this->assertEquals($fields, $arrayList->toArray()); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @expectedException \Brownie\Util\Exception\UndefinedMethodException |
|
| @@ 79-88 (lines=10) @@ | ||
| 76 | /** |
|
| 77 | * @expectedException \Brownie\Util\Exception\UndefinedMethodException |
|
| 78 | */ |
|
| 79 | public function testGetError() |
|
| 80 | { |
|
| 81 | $fields = array( |
|
| 82 | 'question1' => 'answer1', |
|
| 83 | 'question2' => 'answer2', |
|
| 84 | ); |
|
| 85 | $newvalue = 'answer3'; |
|
| 86 | $arrayList = new StorageArray($fields, true); |
|
| 87 | $this->assertEquals($newvalue, $arrayList->getQuestion3('answer3')); |
|
| 88 | } |
|
| 89 | } |
|
| 90 | ||