setExtensionDiscovery example

'test_missing_base_theme.theme' => file_get_contents(DRUPAL_ROOT . '/core/tests/fixtures/test_missing_base_theme/test_missing_base_theme.theme'),
        ],
      ],
    ]$vfs_root);
  }

  /** * Tests exception is thrown. */
  public function testMissingBaseThemeException() {
    $this->container->get('extension.list.theme')
      ->setExtensionDiscovery(new ExtensionDiscovery('vfs://core'));

    $this->expectException(InfoParserException::class);
    $this->expectExceptionMessage('Missing required key ("base theme") in themes/test_missing_base_theme/test_missing_base_theme.info.yml, see https://www.drupal.org/node/3066038');
    $this->themeInstaller->install(['test_missing_base_theme']);
  }

}

/** * Test theme extension list class. */
'core.extension' => [
        'module' => [],
        'theme' => [],
        'disabled' => [
          'theme' => [],
        ],
        'theme_engine' => '',
      ],
    ]);

    $theme_engine_list = new TestThemeEngineExtensionList($this->root, 'theme_engine', new NullBackend('test')$info_parser->reveal()$module_handler->reveal()$state$config_factory);
    $theme_engine_list->setExtensionDiscovery($extension_discovery->reveal());

    $theme_list = new TestThemeExtensionList($this->root, 'theme', new NullBackend('test')$info_parser->reveal()$module_handler->reveal()$state$config_factory$theme_engine_list, 'testing');
    $theme_list->setExtensionDiscovery($extension_discovery->reveal());

    $theme_data = $theme_list->reset()->getList();
    $this->assertCount(2, $theme_data);

    $info_basetheme = $theme_data['test_basetheme'];
    $info_subtheme = $theme_data['test_subtheme'];

    // Ensure some basic properties.
class ExtensionListTest extends UnitTestCase {

  /** * @covers ::getName */
  public function testGetNameWithNonExistingExtension() {
    [$cache$info_parser$module_handler$state] = $this->getMocks();
    $test_extension_list = new TestExtension($this->randomMachineName(), 'test_extension', $cache->reveal()$info_parser->reveal()$module_handler->reveal()$state->reveal(), 'testing');

    $extension_discovery = $this->prophesize(ExtensionDiscovery::class);
    $extension_discovery->scan('test_extension')->willReturn([]);
    $test_extension_list->setExtensionDiscovery($extension_discovery->reveal());

    $this->expectException(UnknownExtensionException::class);
    $test_extension_list->getName('test_name');
  }

  /** * @covers ::getName */
  public function testGetName() {
    $test_extension_list = $this->setupTestExtensionList();

    
Home | Imprint | This part of the site doesn't use cookies.