示例#1
0
 /**
  * Shows a list of Drupal extensions that have composer.json files.
  *
  * @param Event $event
  *   Script event provided by Composer.
  */
 public static function listExtensions(Event $event)
 {
     $root_package = $event->getComposer()->getPackage();
     $root_dir = static::getRootDir();
     $finder = new ComposerFinder();
     $extensions = $finder->getComposerExtensions($root_dir, $root_package->isDev());
     $event->getIO()->write(' Extensions with composer.json files: <info>' . implode(', ', array_keys($extensions)) . '</info>');
 }
 /**
  * @dataProvider provideModuleFilesystem
  */
 public function testGetComposerExtensions($expected_composer_count, $filesystem)
 {
     // Set up the filesystem.
     $root = vfsStream::setup('test', NULL, $filesystem);
     $finder = new ComposerFinder();
     $extensions = $finder->getComposerExtensions(vfsStream::url('test'), FALSE);
     // Make sure we got the right number of results.
     $this->assertEquals($expected_composer_count, count($extensions));
     // Check for expected modules.
     $modules = ['deps', 'site_deps'];
     foreach ($modules as $module) {
         $this->assertArrayHasKey($module, $extensions);
     }
 }