PluginTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\AsynchronousOperations\Test\Unit\Ui\Component\AdminNotification;
  7. use Magento\Framework\AuthorizationInterface;
  8. class PluginTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * @var \Magento\AsynchronousOperations\Ui\Component\AdminNotification\Plugin
  12. */
  13. private $plugin;
  14. /**
  15. * @var \PHPUnit_Framework_MockObject_MockObject
  16. */
  17. private $authorizationMock;
  18. protected function setUp()
  19. {
  20. $this->authorizationMock = $this->createMock(AuthorizationInterface::class);
  21. $this->plugin = new \Magento\AsynchronousOperations\Ui\Component\AdminNotification\Plugin(
  22. $this->authorizationMock
  23. );
  24. }
  25. public function testAfterGetMeta()
  26. {
  27. $result = [];
  28. $expectedResult = [
  29. 'columns' => [
  30. 'arguments' => [
  31. 'data' => [
  32. 'config' => [
  33. 'isAllowed' => true
  34. ]
  35. ]
  36. ]
  37. ]
  38. ];
  39. $dataProviderMock = $this->createMock(\Magento\AdminNotification\Ui\Component\DataProvider\DataProvider::class);
  40. $this->authorizationMock->expects($this->once())->method('isAllowed')->willReturn(true);
  41. $this->assertEquals($expectedResult, $this->plugin->afterGetMeta($dataProviderMock, $result));
  42. }
  43. }