You are here

public function BookUninstallValidatorTest::testValidateEntityQueryWithResults in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php \Drupal\Tests\book\Unit\BookUninstallValidatorTest::testValidateEntityQueryWithResults()

@covers ::validate

File

core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php, line 73
Contains \Drupal\Tests\book\Unit\BookUninstallValidatorTest.

Class

BookUninstallValidatorTest
@coversDefaultClass \Drupal\book\BookUninstallValidator @group book

Namespace

Drupal\Tests\book\Unit

Code

public function testValidateEntityQueryWithResults() {
  $this->bookUninstallValidator
    ->expects($this
    ->once())
    ->method('hasBookOutlines')
    ->willReturn(FALSE);
  $this->bookUninstallValidator
    ->expects($this
    ->once())
    ->method('hasBookNodes')
    ->willReturn(TRUE);
  $module = 'book';
  $expected = [
    'To uninstall Book, delete all content that has the Book content type',
  ];
  $reasons = $this->bookUninstallValidator
    ->validate($module);
  $this
    ->assertSame($expected, $this
    ->castSafeStrings($reasons));
}