| Total Complexity | 1 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | trait LazyExecutionIteratorTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Returns a test double for the specified class. |
||
| 13 | * |
||
| 14 | * @param string|string[] $originalClassName |
||
| 15 | * |
||
| 16 | * @throws Exception |
||
| 17 | * @throws \InvalidArgumentException |
||
| 18 | */ |
||
| 19 | abstract protected function createMock($originalClassName): MockObject; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Create an Iterator mock that fails when traversing. |
||
| 23 | * |
||
| 24 | * @return \Iterator|MockObject |
||
| 25 | */ |
||
| 26 | protected function createLazyExecutionIterator() |
||
| 27 | { |
||
| 28 | $mock = $this->createMock(\Iterator::class); |
||
| 29 | |||
| 30 | $mock->expects($this->any())->method('valid')->willReturn(true); |
||
| 31 | $mock->expects($this->any())->method('rewind'); |
||
| 32 | $mock->expects($this->never())->method('key'); |
||
| 33 | $mock->expects($this->never())->method('current'); |
||
| 34 | |||
| 35 | return $mock; |
||
| 36 | } |
||
| 37 | } |