CommentAdminViewUpdateTest.php in Drupal 8
File
core/modules/comment/tests/src/Functional/Update/CommentAdminViewUpdateTest.php
View source
<?php
namespace Drupal\Tests\comment\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class CommentAdminViewUpdateTest extends UpdatePathTestBase {
protected static $modules = [
'comment',
'views',
];
public function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
];
}
public function testCommentAdminPostUpdateHook() {
$this
->runUpdates();
$entity_type_manager = \Drupal::entityTypeManager();
$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');
$account = $this
->drupalCreateUser([
'administer comments',
]);
$this
->drupalLogin($account);
$this
->drupalGet('admin/content/comment');
$this
->assertText(t('No comments available.'));
}
}