/** * Test getChunk action. */ public function testSyncStorageGetChunk() { $valueMap = [[1, null, null, [1]], [2, null, null, [1, 2]], [0, null, null, null]]; $this->storageManager->expects($this->exactly(count($valueMap) - 1))->method('getNextRecords')->will($this->returnValueMap($valueMap)); foreach ($valueMap as $record) { $records = $this->service->getChunk($record[0], $record[1], $record[2]); $this->assertEquals(count($record[3]), count($records)); } }
/** * {@inheritdoc} */ public function next() { $this->currentChunk = $this->syncStorage->getChunk(1, $this->documentType, $this->shopId); if (empty($this->currentChunk)) { $this->valid = false; return; } $this->currentEntity = $this->entityManager->getRepository($this->entityClass)->find($this->currentChunk[0]['document_id']); if (!empty($this->currentEntity) || $this->currentChunk[0]['type'] == ActionTypes::DELETE) { $this->valid = true; return; } $this->valid = false; }