| Conditions | 2 |
| Paths | 2 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function testGetItems() |
||
| 20 | { |
||
| 21 | $this->client->search(['foo' => 'bar', 'scroll' => '1m']) |
||
| 22 | ->willReturn([ |
||
| 23 | '_scroll_id' => '1', |
||
| 24 | 'hits' => [ |
||
| 25 | 'hits' => [ |
||
| 26 | 'foo' => 'bar' |
||
| 27 | ] |
||
| 28 | ] |
||
| 29 | ]); |
||
| 30 | |||
| 31 | $this->client->search(['foo' => 'bar', 'scroll' => '1m', 'scroll_id' => '1']) |
||
| 32 | ->willReturn([ |
||
| 33 | '_scroll_id' => '2', |
||
| 34 | 'hits' => [] |
||
| 35 | ]); |
||
| 36 | |||
| 37 | $response = $this->reader->getItems(); |
||
| 38 | $items = []; |
||
| 39 | |||
| 40 | foreach ($response as $item) { |
||
| 41 | $items[] = $item; |
||
| 42 | } |
||
| 43 | |||
| 44 | $this->assertEquals(['foo' => 'bar'], $items); |
||
| 45 | } |
||
| 46 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: