RootComposerMappingTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Test\Tools\Composer;
  7. use Magento\Tools\Composer\Package\Reader;
  8. /**
  9. * Class RootComposerMappingTest
  10. */
  11. class RootComposerMappingTest extends \PHPUnit\Framework\TestCase
  12. {
  13. /**
  14. * Test existence of paths for marshalling
  15. * @return void
  16. */
  17. public function testMapping()
  18. {
  19. //Checking existence of composer components
  20. $reader = new Reader(BP . '/dev/tools/Magento/Tools/Composer');
  21. $patterns = $reader->getPatterns();
  22. $counter = 0;
  23. $count = count($patterns);
  24. for ($i = 0; $i < $count; $i++) {
  25. if (file_exists(BP . '/' . $patterns[$i])) {
  26. $counter++;
  27. }
  28. }
  29. $this->assertEquals($count, $counter);
  30. //Checking existence of customizable paths
  31. $customizablePaths = $reader->getCustomizablePaths();
  32. $counter = 0;
  33. $count = count($customizablePaths);
  34. for ($i = 0; $i < $count; $i++) {
  35. if (file_exists(BP . '/' . str_replace('*', '', $customizablePaths[$i]))) {
  36. $counter++;
  37. }
  38. }
  39. $this->assertEquals($count, $counter);
  40. }
  41. }