function BookUninstallValidatorTest::testValidateNotBook

Same name and namespace in other branches
  1. 9 core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php \Drupal\Tests\book\Unit\BookUninstallValidatorTest::testValidateNotBook()
  2. 10 core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php \Drupal\Tests\book\Unit\BookUninstallValidatorTest::testValidateNotBook()
  3. 11.x core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php \Drupal\Tests\book\Unit\BookUninstallValidatorTest::testValidateNotBook()

@covers ::validate

File

core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php, line 36

Class

BookUninstallValidatorTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21book%21src%21BookUninstallValidator.php/class/BookUninstallValidator/8.9.x" title="Prevents book module from being uninstalled whilst any book nodes exist or there are any book outline stored." class="local">\Drupal\book\BookUninstallValidator</a> @group book

Namespace

Drupal\Tests\book\Unit

Code

public function testValidateNotBook() {
    $this->bookUninstallValidator
        ->expects($this->never())
        ->method('hasBookOutlines');
    $this->bookUninstallValidator
        ->expects($this->never())
        ->method('hasBookNodes');
    $module = 'not_book';
    $expected = [];
    $reasons = $this->bookUninstallValidator
        ->validate($module);
    $this->assertSame($expected, $this->castSafeStrings($reasons));
}

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