3 namespace Drupal\Tests\comment\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
8 * Tests that comment admin view is enabled after update.
10 * @see comment_post_update_enable_comment_admin_view()
14 class CommentAdminViewUpdateTest extends UpdatePathTestBase {
19 protected static $modules = ['comment', 'views'];
24 public function setDatabaseDumpFiles() {
25 $this->databaseDumpFiles = [
26 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
31 * Tests that comment admin view is enabled after update.
33 public function testCommentAdminPostUpdateHook() {
35 // Ensure we can load the view from the storage after the update and it's
37 $entity_type_manager = \Drupal::entityTypeManager();
38 /** @var \Drupal\views\ViewEntityInterface $comment_admin_view */
39 $comment_admin_view = $entity_type_manager->getStorage('view')->load('comment');
40 $this->assertNotNull($comment_admin_view, 'Comment admin view exist in storage.');
41 $this->assertTrue($comment_admin_view->enable(), 'Comment admin view is enabled.');
42 $comment_delete_action = $entity_type_manager->getStorage('action')->load('comment_delete_action');
43 $this->assertNotNull($comment_delete_action, 'Comment delete action imported');
44 // Verify comment admin page is working after updates.
45 $account = $this->drupalCreateUser(['administer comments']);
46 $this->drupalLogin($account);
47 $this->drupalGet('admin/content/comment');
48 $this->assertText(t('No comments available.'));