You are here

public function ExtensionDiscoveryTest::testScan in Composer Manager 8

@covers ::scan @covers ::getSiteDirectories

File

tests/src/Unit/ExtensionDiscoveryTest.php, line 83

Class

ExtensionDiscoveryTest
@coversDefaultClass \Drupal\composer_manager\ExtensionDiscovery @group composer_manager

Namespace

Drupal\Tests\composer_manager\Unit

Code

public function testScan() {
  $expected_profiles = [
    'commons',
    'commerce_kickstart',
  ];
  $profiles = $this->discovery
    ->scan('profile');
  $this
    ->assertEquals($expected_profiles, array_keys($profiles));
  $expected_extensions = [
    'test5',
    'test2',
    'test3',
    'test1',
    'test4',
    'test6',
  ];
  $profile_directories = array_map(function ($profile) {
    return $profile
      ->getPath();
  }, $profiles);
  $this->discovery
    ->setProfileDirectories($profile_directories);
  $extensions = $this->discovery
    ->scan('module');
  $this
    ->assertEquals($expected_extensions, array_keys($extensions));
}