Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BulkNotificationManagementTest.php
Go to the documentation of this file.
1 <?php
7 
11 
12 class BulkNotificationManagementTest extends \PHPUnit\Framework\TestCase
13 {
17  private $model;
18 
22  private $objectManager;
23 
24  protected function setUp()
25  {
26  $this->objectManager = Bootstrap::getObjectManager();
27 
28  $this->model = $this->objectManager->create(
29  BulkNotificationManagement::class
30  );
31  }
32 
36  public function testAcknowledgeBulks()
37  {
38  $this->model->acknowledgeBulks(['bulk-uuid-5']);
39 
40  $acknowledgedBulks = $this->model->getAcknowledgedBulksByUser(1);
41  $this->assertCount(1, $acknowledgedBulks);
43  $acknowledgedBulk = array_pop($acknowledgedBulks);
44  $this->assertEquals('bulk-uuid-5', $acknowledgedBulk->getBulkId());
45  }
46 
50  public function testIgnoreBulks()
51  {
52  // 'bulk-uuid-5' and 'bulk-uuid-4' are marked as acknowledged in fixture
53  $this->model->ignoreBulks(['bulk-uuid-5']);
54 
55  $acknowledgedBulks = $this->model->getAcknowledgedBulksByUser(1);
56  $this->assertCount(1, $acknowledgedBulks);
58  $acknowledgedBulk = array_pop($acknowledgedBulks);
59  $this->assertEquals('bulk-uuid-4', $acknowledgedBulk->getBulkId());
60  }
61 
65  public function testGetAcknowledgedBulks()
66  {
67  // 'bulk-uuid-5' and 'bulk-uuid-4' are marked as acknowledged in fixture
68  $acknowledgedBulks = $this->model->getAcknowledgedBulksByUser(1);
69  $this->assertCount(2, $acknowledgedBulks);
70  }
71 
75  public function testGetIgnoredBulks()
76  {
77  // 'bulk-uuid-5' and 'bulk-uuid-4' are marked as acknowledged in fixture. Fixture creates 5 bulks in total.
78  $ignoredBulks = $this->model->getIgnoredBulksByUser(1);
79  $this->assertCount(3, $ignoredBulks);
80  }
81 }