/** * Test if extract is able to add data to the storage for item delete action. */ public function testExtractForDeleteItem() { $category = 'product'; $id = 123; $timestamp = new DateTime('-1 hour 20 minutes'); $deleteDiffItem = new DeleteDiffItem(); $deleteDiffItem->setCategory($category); $deleteDiffItem->setItemId($id); $deleteDiffItem->setTimestamp($timestamp); $this->extractor->extract($deleteDiffItem); foreach ($this->shopIds as $shopId) { $actual = (object) $this->getConnection()->fetchAssoc('SELECT * FROM ' . $this->storageManager->getTableName($shopId) . ' WHERE `type` = :operationType AND `document_type` = :documentType AND `document_id` = :documentId AND `status` = :status', ['operationType' => ActionTypes::DELETE, 'documentType' => $category, 'documentId' => $id, 'status' => 0]); $this->assertTrue(!empty($actual->id)); $this->assertEquals(ActionTypes::DELETE, $actual->type); $this->assertEquals($category, $actual->document_type); $this->assertEquals($id, $actual->document_id); $this->assertEquals($timestamp, new DateTime($actual->timestamp)); } }
/** * Test getStorageFacility. */ public function testGetStorageFacility() { $this->assertSame($this->storage, $this->service->getStorageFacility()); }