public function CommentAdminViewUpdateTest::testCommentAdminPostUpdateHook in Drupal 8
Tests that comment admin view is enabled after update.
File
- core/
modules/ comment/ tests/ src/ Functional/ Update/ CommentAdminViewUpdateTest.php, line 34
Class
- CommentAdminViewUpdateTest
- Tests that comment admin view is enabled after update.
Namespace
Drupal\Tests\comment\Functional\UpdateCode
public function testCommentAdminPostUpdateHook() {
$this
->runUpdates();
// Ensure we can load the view from the storage after the update and it's
// enabled.
$entity_type_manager = \Drupal::entityTypeManager();
/** @var \Drupal\views\ViewEntityInterface $comment_admin_view */
$comment_admin_view = $entity_type_manager
->getStorage('view')
->load('comment');
$this
->assertNotNull($comment_admin_view, 'Comment admin view exist in storage.');
$this
->assertTrue((bool) $comment_admin_view
->enable()
->get('status'), 'Comment admin view is enabled.');
$comment_delete_action = $entity_type_manager
->getStorage('action')
->load('comment_delete_action');
$this
->assertNotNull($comment_delete_action, 'Comment delete action imported');
// Verify comment admin page is working after updates.
$account = $this
->drupalCreateUser([
'administer comments',
]);
$this
->drupalLogin($account);
$this
->drupalGet('admin/content/comment');
$this
->assertText(t('No comments available.'));
}