RootComposerMappingTest.php 1.23 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Test\Tools\Composer;

use Magento\Tools\Composer\Package\Reader;

/**
 * Class RootComposerMappingTest
 */
class RootComposerMappingTest extends \PHPUnit\Framework\TestCase
{
    /**
     * Test existence of paths for marshalling
     * @return void
     */
    public function testMapping()
    {
        //Checking existence of composer components
        $reader = new Reader(BP . '/dev/tools/Magento/Tools/Composer');
        $patterns = $reader->getPatterns();
        $counter = 0;
        $count = count($patterns);
        for ($i = 0; $i < $count; $i++) {
            if (file_exists(BP . '/' . $patterns[$i])) {
                $counter++;
            }
        }

        $this->assertEquals($count, $counter);

        //Checking existence of customizable paths
        $customizablePaths = $reader->getCustomizablePaths();
        $counter = 0;
        $count = count($customizablePaths);
        for ($i = 0; $i < $count; $i++) {
            if (file_exists(BP . '/' . str_replace('*', '', $customizablePaths[$i]))) {
                $counter++;
            }
        }

        $this->assertEquals($count, $counter);
    }
}