| @@ 104-119 (lines=16) @@ | ||
| 101 | $this->assertNull($this->list->shift()); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function testPop() { |
|
| 105 | $this->list->push(20); |
|
| 106 | $this->list->push(true); |
|
| 107 | $this->list->push(15); |
|
| 108 | $this->list->push(3.14); |
|
| 109 | $this->list->push("string"); |
|
| 110 | ||
| 111 | $this->assertEquals($this->list->pop(), "string"); |
|
| 112 | $this->assertEquals(3.14, $this->list->pop()); |
|
| 113 | $this->list->insert(1, ['hello']); |
|
| 114 | $this->assertEquals(15, $this->list->pop()); |
|
| 115 | $this->assertTrue($this->list->pop()); |
|
| 116 | $this->assertSame($this->list->pop(), ['hello']); |
|
| 117 | $this->assertSame($this->list->pop(), 20); |
|
| 118 | $this->assertTrue($this->list->empty()); |
|
| 119 | } |
|
| 120 | ||
| 121 | public function testPopException() { |
|
| 122 | $this->expectException(OutOfBoundsException::class); |
|
| @@ 104-119 (lines=16) @@ | ||
| 101 | $this->assertNull($this->list->shift()); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function testPop() { |
|
| 105 | $this->list->push(20); |
|
| 106 | $this->list->push(true); |
|
| 107 | $this->list->push(15); |
|
| 108 | $this->list->push(3.14); |
|
| 109 | $this->list->push("string"); |
|
| 110 | ||
| 111 | $this->assertEquals($this->list->pop(), "string"); |
|
| 112 | $this->assertEquals(3.14, $this->list->pop()); |
|
| 113 | $this->list->insert(1, ['hello']); |
|
| 114 | $this->assertEquals(15, $this->list->pop()); |
|
| 115 | $this->assertTrue($this->list->pop()); |
|
| 116 | $this->assertSame($this->list->pop(), ['hello']); |
|
| 117 | $this->assertSame($this->list->pop(), 20); |
|
| 118 | $this->assertTrue($this->list->empty()); |
|
| 119 | } |
|
| 120 | ||
| 121 | public function testPopException() { |
|
| 122 | $this->expectException(OutOfBoundsException::class); |
|