You are here

public function RequiredModuleUninstallValidatorTest::testValidateRequired in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php \Drupal\Tests\Core\Extension\RequiredModuleUninstallValidatorTest::testValidateRequired()

@covers ::validate

File

core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php, line 70
Contains \Drupal\Tests\Core\Extension\RequiredModuleUninstallValidatorTest.

Class

RequiredModuleUninstallValidatorTest
@coversDefaultClass \Drupal\Core\Extension\RequiredModuleUninstallValidator @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testValidateRequired() {
  $module = $this
    ->randomMachineName();
  $this->uninstallValidator
    ->expects($this
    ->once())
    ->method('getModuleInfoByModule')
    ->willReturn([
    'required' => TRUE,
    'name' => $module,
  ]);
  $expected = [
    "The {$module} module is required",
  ];
  $reasons = $this->uninstallValidator
    ->validate($module);
  $this
    ->assertSame($expected, $this
    ->castSafeStrings($reasons));
}