public function ForumUninstallValidatorTest::testValidateHasTermsForVocabularyWithNodesAccess in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php \Drupal\Tests\forum\Unit\ForumUninstallValidatorTest::testValidateHasTermsForVocabularyWithNodesAccess()
@covers ::validate
File
- core/
modules/ forum/ tests/ src/ Unit/ ForumUninstallValidatorTest.php, line 106 - Contains \Drupal\Tests\forum\Unit\ForumUninstallValidatorTest.
Class
- ForumUninstallValidatorTest
- @coversDefaultClass \Drupal\forum\ForumUninstallValidator @group forum
Namespace
Drupal\Tests\forum\UnitCode
public function testValidateHasTermsForVocabularyWithNodesAccess() {
$this->forumUninstallValidator
->expects($this
->once())
->method('hasForumNodes')
->willReturn(TRUE);
$vocabulary = $this
->getMock('Drupal\\taxonomy\\VocabularyInterface');
$vocabulary
->expects($this
->once())
->method('label')
->willReturn('Vocabulary label');
$vocabulary
->expects($this
->once())
->method('url')
->willReturn('/path/to/vocabulary/overview');
$vocabulary
->expects($this
->once())
->method('access')
->willReturn(TRUE);
$this->forumUninstallValidator
->expects($this
->once())
->method('getForumVocabulary')
->willReturn($vocabulary);
$this->forumUninstallValidator
->expects($this
->once())
->method('hasTermsForVocabulary')
->willReturn(TRUE);
$module = 'forum';
$expected = [
'To uninstall Forum, first delete all <em>Forum</em> content',
'To uninstall Forum, first delete all <a href="/path/to/vocabulary/overview"><em class="placeholder">Vocabulary label</em></a> terms',
];
$reasons = $this->forumUninstallValidator
->validate($module);
$this
->assertSame($expected, $this
->castSafeStrings($reasons));
}