objectManager = Bootstrap::getObjectManager(); $this->model = $this->objectManager->create( BulkNotificationManagement::class ); } /** * @magentoDataFixture Magento/AsynchronousOperations/_files/bulk.php */ public function testAcknowledgeBulks() { $this->model->acknowledgeBulks(['bulk-uuid-5']); $acknowledgedBulks = $this->model->getAcknowledgedBulksByUser(1); $this->assertCount(1, $acknowledgedBulks); /** @var BulkSummaryInterface $acknowledgedBulk */ $acknowledgedBulk = array_pop($acknowledgedBulks); $this->assertEquals('bulk-uuid-5', $acknowledgedBulk->getBulkId()); } /** * @magentoDataFixture Magento/AsynchronousOperations/_files/acknowledged_bulk.php */ public function testIgnoreBulks() { // 'bulk-uuid-5' and 'bulk-uuid-4' are marked as acknowledged in fixture $this->model->ignoreBulks(['bulk-uuid-5']); $acknowledgedBulks = $this->model->getAcknowledgedBulksByUser(1); $this->assertCount(1, $acknowledgedBulks); /** @var BulkSummaryInterface $acknowledgedBulk */ $acknowledgedBulk = array_pop($acknowledgedBulks); $this->assertEquals('bulk-uuid-4', $acknowledgedBulk->getBulkId()); } /** * @magentoDataFixture Magento/AsynchronousOperations/_files/acknowledged_bulk.php */ public function testGetAcknowledgedBulks() { // 'bulk-uuid-5' and 'bulk-uuid-4' are marked as acknowledged in fixture $acknowledgedBulks = $this->model->getAcknowledgedBulksByUser(1); $this->assertCount(2, $acknowledgedBulks); } /** * @magentoDataFixture Magento/AsynchronousOperations/_files/acknowledged_bulk.php */ public function testGetIgnoredBulks() { // 'bulk-uuid-5' and 'bulk-uuid-4' are marked as acknowledged in fixture. Fixture creates 5 bulks in total. $ignoredBulks = $this->model->getIgnoredBulksByUser(1); $this->assertCount(3, $ignoredBulks); } }