You are here

public function RequiredModuleUninstallValidatorTest::testValidateNotRequired in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php \Drupal\Tests\Core\Extension\RequiredModuleUninstallValidatorTest::testValidateNotRequired()
  2. 10 core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php \Drupal\Tests\Core\Extension\RequiredModuleUninstallValidatorTest::testValidateNotRequired()

@covers ::validate

File

core/tests/Drupal/Tests/Core/Extension/RequiredModuleUninstallValidatorTest.php, line 50

Class

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

Namespace

Drupal\Tests\Core\Extension

Code

public function testValidateNotRequired() {
  $module = $this
    ->randomMachineName();
  $this->uninstallValidator
    ->expects($this
    ->once())
    ->method('getModuleInfoByModule')
    ->willReturn([
    'required' => FALSE,
    'name' => $module,
  ]);
  $expected = [];
  $reasons = $this->uninstallValidator
    ->validate($module);
  $this
    ->assertSame($expected, $reasons);
}