function ExtensionListTest::testGetWithNonExistingExtension

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php \Drupal\Tests\Core\Extension\ExtensionListTest::testGetWithNonExistingExtension()
  2. 10 core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php \Drupal\Tests\Core\Extension\ExtensionListTest::testGetWithNonExistingExtension()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php \Drupal\Tests\Core\Extension\ExtensionListTest::testGetWithNonExistingExtension()

@covers ::get

File

core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php, line 51

Class

ExtensionListTest
@coversDefaultClass \Drupal\Core\Extension\ExtensionList @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testGetWithNonExistingExtension() {
    [
        $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->get('test_name');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.