function ForumUninstallValidatorTest::testValidateHasTermsForVocabularyAccess
Same name in other branches
- 9 core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php \Drupal\Tests\forum\Unit\ForumUninstallValidatorTest::testValidateHasTermsForVocabularyAccess()
- 10 core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php \Drupal\Tests\forum\Unit\ForumUninstallValidatorTest::testValidateHasTermsForVocabularyAccess()
- 11.x core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php \Drupal\Tests\forum\Unit\ForumUninstallValidatorTest::testValidateHasTermsForVocabularyAccess()
@covers ::validate
File
-
core/
modules/ forum/ tests/ src/ Unit/ ForumUninstallValidatorTest.php, line 174
Class
- ForumUninstallValidatorTest
- @coversDefaultClass \Drupal\forum\ForumUninstallValidator @group forum
Namespace
Drupal\Tests\forum\UnitCode
public function testValidateHasTermsForVocabularyAccess() {
$this->forumUninstallValidator
->expects($this->once())
->method('hasForumNodes')
->willReturn(FALSE);
$url = $this->prophesize(Url::class);
$url->toString()
->willReturn('/path/to/vocabulary/overview');
$vocabulary = $this->createMock('Drupal\\taxonomy\\VocabularyInterface');
$vocabulary->expects($this->once())
->method('toUrl')
->willReturn($url->reveal());
$vocabulary->expects($this->once())
->method('label')
->willReturn('Vocabulary label');
$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 <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));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.