function ModuleHandlerTest::testModuleExists

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testModuleExists()
  2. 10 core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testModuleExists()
  3. 11.x core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testModuleExists()

Test module exists returns correct module status.

@covers ::moduleExists

File

core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php, line 249

Class

ModuleHandlerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleHandler.php/class/ModuleHandler/8.9.x" title="Class that manages modules in a Drupal installation." class="local">\Drupal\Core\Extension\ModuleHandler</a> @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Core\Extension

Code

public function testModuleExists() {
    $module_handler = $this->getModuleHandler();
    $this->assertTrue($module_handler->moduleExists('module_handler_test'));
    $this->assertFalse($module_handler->moduleExists('module_handler_test_added'));
}

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