DepsTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Ui\Test\Unit\Config\Converter;
  7. use Magento\Framework\Data\Argument\Interpreter\Composite;
  8. use Magento\Ui\Config\Converter\Deps;
  9. use Magento\Ui\Config\ConverterUtils;
  10. class DepsTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /**
  13. * @var Deps
  14. */
  15. private $converter;
  16. public function setUp()
  17. {
  18. $this->converter = new Deps(new ConverterUtils());
  19. }
  20. public function testConvert()
  21. {
  22. $expectedResult = [
  23. 'name' => 'deps',
  24. 'xsi:type' => 'array',
  25. 'item' => [
  26. [
  27. 'name' => 0,
  28. 'xsi:type' => 'string',
  29. 'value' => 'test-dep',
  30. ],
  31. [
  32. 'name' => 1,
  33. 'xsi:type' => 'string',
  34. 'value' => 'test-dep-two',
  35. ],
  36. ],
  37. ];
  38. $dom = new \DOMDocument('1.0', 'UTF-8');
  39. $dom->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'test.xml');
  40. $domXpath = new \DOMXPath($dom);
  41. $deps = $domXpath->query('//listing/settings/deps')->item(0);
  42. $this->assertEquals($expectedResult, $this->converter->convert($deps));
  43. }
  44. }