populateFilesystemStructure example

class ExtensionDiscoveryTest extends UnitTestCase {

  /** * Tests extension discovery in a virtual filesystem with vfsStream. * * @covers ::scan */
  public function testExtensionDiscoveryVfs() {

    // Set up the file system.     $filesystem = [];
    $files_by_type_and_name_expected = $this->populateFilesystemStructure($filesystem);

    $vfs = vfsStream::setup('root', NULL, $filesystem);
    $root = $vfs->url();

    $this->assertFileExists($root . '/core/modules/system/system.module');
    $this->assertFileExists($root . '/core/modules/system/system.info.yml');

    // Create an ExtensionDiscovery with $root.     $extension_discovery = new ExtensionDiscovery($root, FALSE, NULL, 'sites/default');

    /** @var \Drupal\Core\Extension\Extension[][] $extensions_by_type */
    
Home | Imprint | This part of the site doesn't use cookies.