28 private $wrapperSelectMock;
33 private $connectionMock;
43 private $correlationName;
53 private $rangeFieldAlias;
58 private $currentBatch = 0;
67 $this->batchSize = 10;
68 $this->currentBatch = 0;
69 $this->correlationName =
'correlationName';
70 $this->rangeField =
'rangeField';
71 $this->rangeFieldAlias =
'rangeFieldAlias';
73 $this->selectMock = $this->createMock(Select::class);
74 $this->wrapperSelectMock = $this->createMock(Select::class);
75 $this->connectionMock = $this->createMock(AdapterInterface::class);
76 $this->connectionMock->expects($this->any())->method(
'select')->willReturn($this->wrapperSelectMock);
77 $this->selectMock->expects($this->once())->method(
'getConnection')->willReturn($this->connectionMock);
78 $this->connectionMock->expects($this->any())->method(
'quoteIdentifier')->willReturnArgument(0);
83 $this->correlationName,
85 $this->rangeFieldAlias
97 $this->selectMock->expects($this->once())->method(
'limit')->with($this->batchSize, $this->currentBatch);
98 $this->selectMock->expects($this->once())->method(
'order')->with(
'correlationName.rangeField' .
' ASC');
99 $this->assertEquals($this->selectMock, $this->model->current());
100 $this->assertEquals(0, $this->model->key());
110 $this->connectionMock->expects($this->once())
112 ->willReturn([
'cnt' => 105]);
114 foreach ($this->model as $key) {
115 $this->assertEquals($this->selectMock, $key);
119 $this->assertEquals(11, $iterations);