IndexTest.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Controller\Adminhtml\Dispatch;
  6. use Magento\Framework\Session\SessionManagerInterface;
  7. use Magento\TestFramework\Helper\Bootstrap;
  8. use Magento\TestFramework\TestCase\AbstractBackendController;
  9. use Temando\Shipping\Rest\AuthenticationInterface;
  10. /**
  11. * @magentoAppArea adminhtml
  12. */
  13. class IndexTest extends AbstractBackendController
  14. {
  15. /**
  16. * The resource used to authorize action
  17. *
  18. * @var string
  19. */
  20. protected $resource = 'Temando_Shipping::dispatches';
  21. /**
  22. * The uri at which to access the controller
  23. *
  24. * @var string
  25. */
  26. protected $uri = 'backend/temando/dispatch/index';
  27. protected function setUp()
  28. {
  29. parent::setUp();
  30. /** @var SessionManagerInterface $adminSession */
  31. $adminSession = Bootstrap::getObjectManager()->get(SessionManagerInterface::class);
  32. $adminSession->setData(AuthenticationInterface::DATA_KEY_SESSION_TOKEN_EXPIRY, '2038-01-19T03:03:33.000Z');
  33. }
  34. /**
  35. * @test
  36. * @magentoConfigFixture default/carriers/temando/account_id 23
  37. * @magentoConfigFixture default/carriers/temando/bearer_token 808
  38. */
  39. public function pageIsRendered()
  40. {
  41. $this->dispatch($this->uri);
  42. $this->assertContains('DispatchList', $this->getResponse()->getBody());
  43. }
  44. /**
  45. * @test
  46. * @magentoConfigFixture default/carriers/temando/account_id 23
  47. * @magentoConfigFixture default/carriers/temando/bearer_token 808
  48. */
  49. public function testAclHasAccess()
  50. {
  51. parent::testAclHasAccess();
  52. }
  53. /**
  54. * @test
  55. * @magentoConfigFixture default/carriers/temando/account_id 23
  56. * @magentoConfigFixture default/carriers/temando/bearer_token 808
  57. */
  58. public function testAclNoAccess()
  59. {
  60. parent::testAclNoAccess();
  61. }
  62. }