DataTest.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Integration\Test\Unit\Helper;
  7. use Magento\Integration\Model\Integration;
  8. class DataTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /** @var \Magento\Integration\Helper\Data */
  11. protected $dataHelper;
  12. protected function setUp()
  13. {
  14. $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  15. $this->dataHelper = $helper->getObject(\Magento\Integration\Helper\Data::class);
  16. }
  17. public function testMapResources()
  18. {
  19. $testData = require __DIR__ . '/_files/acl.php';
  20. $expectedData = require __DIR__ . '/_files/acl-map.php';
  21. $this->assertEquals($expectedData, $this->dataHelper->mapResources($testData));
  22. }
  23. /**
  24. * @dataProvider integrationDataProvider
  25. */
  26. public function testIsConfigType($integrationsData, $expectedResult)
  27. {
  28. $this->assertEquals($expectedResult, $this->dataHelper->isConfigType($integrationsData));
  29. }
  30. /**
  31. * @return array
  32. */
  33. public function integrationDataProvider()
  34. {
  35. return [
  36. [
  37. [
  38. 'id' => 1,
  39. Integration::NAME => 'TestIntegration1',
  40. Integration::EMAIL => 'test-integration1@magento.com',
  41. Integration::ENDPOINT => 'http://endpoint.com',
  42. Integration::SETUP_TYPE => 1,
  43. ],
  44. true,
  45. ],
  46. [
  47. [
  48. 'id' => 1,
  49. Integration::NAME => 'TestIntegration1',
  50. Integration::EMAIL => 'test-integration1@magento.com',
  51. Integration::ENDPOINT => 'http://endpoint.com',
  52. Integration::SETUP_TYPE => 0,
  53. ],
  54. false,
  55. ]
  56. ];
  57. }
  58. }