CircularTest.php 802 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Setup\Module\Dependency;
  7. class CircularTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var Circular
  11. */
  12. protected $circular;
  13. protected function setUp()
  14. {
  15. $this->circular = new Circular();
  16. }
  17. public function testBuildCircularDependencies()
  18. {
  19. $dependencies = [1 => [2], 2 => [3, 5], 3 => [1], 5 => [2]];
  20. $expectedCircularDependencies = [
  21. 1 => [[1, 2, 3, 1]],
  22. 2 => [[2, 3, 1, 2], [2, 5, 2]],
  23. 3 => [[3, 1, 2, 3]],
  24. 5 => [[5, 2, 5]],
  25. ];
  26. $this->assertEquals($expectedCircularDependencies, $this->circular->buildCircularDependencies($dependencies));
  27. }
  28. }