function ForumUninstallValidatorTest::testValidateNotForum

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

@covers ::validate

File

core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php, line 37

Class

ForumUninstallValidatorTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21forum%21src%21ForumUninstallValidator.php/class/ForumUninstallValidator/8.9.x" title="Prevents forum module from being uninstalled whilst any forum nodes exist or there are any terms in the forum vocabulary." class="local">\Drupal\forum\ForumUninstallValidator</a> @group forum

Namespace

Drupal\Tests\forum\Unit

Code

public function testValidateNotForum() {
    $this->forumUninstallValidator
        ->expects($this->never())
        ->method('hasForumNodes');
    $this->forumUninstallValidator
        ->expects($this->never())
        ->method('hasTermsForVocabulary');
    $this->forumUninstallValidator
        ->expects($this->never())
        ->method('getForumVocabulary');
    $module = 'not_forum';
    $expected = [];
    $reasons = $this->forumUninstallValidator
        ->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.