Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / comment / tests / src / Functional / Update / CommentAdminViewUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests that comment admin view is enabled after update.
9  *
10  * @see comment_post_update_enable_comment_admin_view()
11  *
12  * @group Update
13  */
14 class CommentAdminViewUpdateTest extends UpdatePathTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   protected static $modules = ['comment', 'views'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function setDatabaseDumpFiles() {
25     $this->databaseDumpFiles = [
26       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
27     ];
28   }
29
30   /**
31    * Tests that comment admin view is enabled after update.
32    */
33   public function testCommentAdminPostUpdateHook() {
34     $this->runUpdates();
35     // Ensure we can load the view from the storage after the update and it's
36     // enabled.
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.'));
49   }
50
51 }