function CommentUninstallTest::testCommentUninstallWithField
Same name in other branches
- 8.9.x core/modules/comment/tests/src/Kernel/CommentUninstallTest.php \Drupal\Tests\comment\Kernel\CommentUninstallTest::testCommentUninstallWithField()
- 10 core/modules/comment/tests/src/Kernel/CommentUninstallTest.php \Drupal\Tests\comment\Kernel\CommentUninstallTest::testCommentUninstallWithField()
- 11.x core/modules/comment/tests/src/Kernel/CommentUninstallTest.php \Drupal\Tests\comment\Kernel\CommentUninstallTest::testCommentUninstallWithField()
Tests if comment module uninstall fails if the field exists.
File
-
core/
modules/ comment/ tests/ src/ Kernel/ CommentUninstallTest.php, line 56
Class
- CommentUninstallTest
- Tests comment module uninstall.
Namespace
Drupal\Tests\comment\KernelCode
public function testCommentUninstallWithField() {
// Ensure that the field exists before uninstalling.
$field_storage = FieldStorageConfig::loadByName('comment', 'comment_body');
$this->assertNotNull($field_storage);
// Uninstall the comment module which should trigger an exception.
$this->expectException(ModuleUninstallValidatorException::class);
$this->expectExceptionMessage('The following reasons prevent the modules from being uninstalled: The <em class="placeholder">Comments</em> field type is used in the following field: node.comment');
$this->container
->get('module_installer')
->uninstall([
'comment',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.