/**
  * Test if extraction for "delete" item works.
  */
 public function testCreatingDeleteItem()
 {
     $category = 'product';
     $id = 123;
     $timestamp = new \DateTime('-1 hour');
     $diffItem = new DeleteDiffItem();
     $diffItem->setCategory($category);
     $diffItem->setTimestamp($timestamp);
     $diffItem->setItemId($id);
     $this->storage->expects($this->once())->method('save')->with(ActionTypes::DELETE, $category, $id, $timestamp);
     $this->service->extract($diffItem);
 }
 /**
  * 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));
     }
 }