Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NotificationDismissActionsTest.php
Go to the documentation of this file.
1 <?php
8 
11 
12 class NotificationDismissActionsTest extends \PHPUnit\Framework\TestCase
13 {
17  private $context;
18 
22  private $uiComponentFactory;
23 
27  private $actionColumn;
28 
32  protected function setUp()
33  {
34  $this->context = $this->createMock(\Magento\Framework\View\Element\UiComponent\ContextInterface::class);
35  $this->uiComponentFactory = $this->createMock(\Magento\Framework\View\Element\UiComponentFactory::class);
36  $processor = $this->createPartialMock(
37  \Magento\Framework\View\Element\UiComponent\Processor::class,
38  ['getProcessor']
39  );
40  $this->context->expects($this->never())->method('getProcessor')->will($this->returnValue($processor));
41  $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
42  $this->actionColumn = $objectManager->getObject(
43  \Magento\AsynchronousOperations\Ui\Component\Listing\Column\NotificationDismissActions::class,
44  [
45  'context' => $this->context,
46  'uiComponentFactory' => $this->uiComponentFactory,
47  'components' => [],
48  'data' => ['name' => 'actions']
49  ]
50  );
51  }
52 
53  public function testPrepareDataSource()
54  {
55  $testData['data']['items'] = [
56  [
57  'key' => 'value',
58  ],
59  [
60  BulkSummary::BULK_ID => 'uuid-1',
62  ],
63  [
65  ],
66  ];
67  $expectedResult['data']['items'] = [
68  [
69  'key' => 'value',
70  ],
71  [
72  BulkSummary::BULK_ID => 'uuid-1',
74  'actions' => [
75  'dismiss' => [
76  'href' => '#',
77  'label' => __('Dismiss'),
78  'callback' => [
79  [
80  'provider' => 'ns = notification_area, index = columns',
81  'target' => 'dismiss',
82  'params' => [
83  0 => 'uuid-1',
84  ],
85  ],
86  ],
87  ],
88  ],
89  ],
90  [
92  ],
93  ];
94  $this->assertEquals($expectedResult, $this->actionColumn->prepareDataSource($testData));
95  }
96 }
$objectManager
Definition: bootstrap.php:17
$processor
Definition: 404.php:10
__()
Definition: __.php:13