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