|
@@ 105-111 (lines=7) @@
|
| 102 |
|
* |
| 103 |
|
* @return void |
| 104 |
|
*/ |
| 105 |
|
public function consecutiveCurrent() |
| 106 |
|
{ |
| 107 |
|
$client = new Client('not under tests', 'not under test', new CollectionAdapter()); |
| 108 |
|
$collection = new Collection($client, 'not under tests', ['limit' => 3]); |
| 109 |
|
$this->assertSame(0, $collection->current()->id); |
| 110 |
|
$this->assertSame(0, $collection->current()->id); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
/** |
| 114 |
|
* Verifies code does not explode when next() consectutively. |
|
@@ 121-129 (lines=9) @@
|
| 118 |
|
* |
| 119 |
|
* @return void |
| 120 |
|
*/ |
| 121 |
|
public function consecutiveNext() |
| 122 |
|
{ |
| 123 |
|
$client = new Client('not under tests', 'not under test', new CollectionAdapter()); |
| 124 |
|
$collection = new Collection($client, 'not under tests', ['limit' => 3]); |
| 125 |
|
$collection->next(); |
| 126 |
|
$collection->next(); |
| 127 |
|
$this->assertSame(1, $collection->current()->id); |
| 128 |
|
$this->assertSame('a title for comic 1', $collection->current()->title); |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
/** |
| 132 |
|
* Verifies count() lazy loads the next result. |
|
@@ 169-175 (lines=7) @@
|
| 166 |
|
* |
| 167 |
|
* @return void |
| 168 |
|
*/ |
| 169 |
|
public function current() |
| 170 |
|
{ |
| 171 |
|
$client = new Client('not under tests', 'not under test', new CollectionAdapter()); |
| 172 |
|
$collection = new Collection($client, 'not under tests', ['limit' => 3]); |
| 173 |
|
$this->assertSame(0, $collection->current()->getId()); |
| 174 |
|
$this->assertSame('a title for comic 0', $collection->current()->getTitle()); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
/** |
| 178 |
|
* Verfies current() throws when collection is empty. |