model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\AsynchronousOperations\Model\OperationManagement::class ); $this->bulkStatusManagement = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\AsynchronousOperations\Model\BulkStatus::class ); $this->operationFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( OperationInterfaceFactory::class ); $this->entityManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( EntityManager::class ); } /** * @magentoDataFixture Magento/AsynchronousOperations/_files/bulk.php */ public function testGetBulkStatus() { $operations = $this->bulkStatusManagement->getFailedOperationsByBulkId('bulk-uuid-5', 3); if (empty($operations)) { $this->fail('Operation doesn\'t exist'); } /** @var OperationInterface $operation */ $operation = array_shift($operations); $operationId = $operation->getId(); $this->assertTrue($this->model->changeOperationStatus($operationId, OperationInterface::STATUS_TYPE_OPEN)); /** @var OperationInterface $updatedOperation */ $updatedOperation = $this->operationFactory->create(); $this->entityManager->load($updatedOperation, $operationId); $this->assertEquals(OperationInterface::STATUS_TYPE_OPEN, $updatedOperation->getStatus()); $this->assertEquals(null, $updatedOperation->getResultMessage()); $this->assertEquals(null, $updatedOperation->getSerializedData()); } }