1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AsynchronousOperations\Model;
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Framework\ObjectManagerInterface;
class BulkNotificationManagementTest extends \PHPUnit\Framework\TestCase
{
/**
* @var BulkNotificationManagement
*/
private $model;
/**
* @var ObjectManagerInterface
*/
private $objectManager;
protected function setUp()
{
$this->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);
}
}