function BookUninstallValidatorTest::testValidateEntityQueryWithResults

Same name in other branches
  1. 9 core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php \Drupal\Tests\book\Unit\BookUninstallValidatorTest::testValidateEntityQueryWithResults()
  2. 8.9.x core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php \Drupal\Tests\book\Unit\BookUninstallValidatorTest::testValidateEntityQueryWithResults()
  3. 11.x 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 68

Class

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

Namespace

Drupal\Tests\book\Unit

Code

public function testValidateEntityQueryWithResults() : void {
    $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->assertEquals($expected, $reasons);
}

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