3 namespace Drupal\Tests\comment\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
8 * Tests that comment settings are properly updated during database updates.
13 class CommentUpdateTest extends UpdatePathTestBase {
18 protected function setDatabaseDumpFiles() {
19 $this->databaseDumpFiles = [
20 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8-rc1.filled.standard.php.gz',
25 * Tests comment_update_8200().
27 * @see comment_update_8200()
29 public function testCommentUpdate8101() {
30 // Load the 'node.article.default' entity view display config, and check
31 // that component 'comment' does not contain the 'view_mode' setting.
32 $config = $this->config('core.entity_view_display.node.article.default');
33 $this->assertNull($config->get('content.comment.settings.view_mode'));
35 // Load the 'node.forum.default' entity view display config, and check that
36 // component 'comment_forum' does not contain the 'view_mode' setting.
37 $config = $this->config('core.entity_view_display.node.forum.default');
38 $this->assertNull($config->get('content.comment_forum.settings.view_mode'));
43 // Check that 'node.article.default' entity view display setting 'view_mode'
44 // has the value 'default'.
45 $config = $this->config('core.entity_view_display.node.article.default');
46 $this->assertIdentical($config->get('content.comment.settings.view_mode'), 'default');
48 // Check that 'node.forum.default' entity view display setting 'view_mode'
49 // has the value 'default'.
50 $config = $this->config('core.entity_view_display.node.forum.default');
51 $this->assertIdentical($config->get('content.comment_forum.settings.view_mode'), 'default');
55 * Tests that the comment entity type has a 'published' entity key.
57 * @see comment_update_8301()
59 public function testPublishedEntityKey() {
60 // Check that the 'published' entity key does not exist prior to the update.
61 $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
62 $this->assertFalse($entity_type->getKey('published'));
67 // Check that the entity key exists and it has the correct value.
68 $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
69 $this->assertEqual('status', $entity_type->getKey('published'));
71 // Check that the {comment_field_data} table status index has been created.
72 $this->assertTrue(\Drupal::database()->schema()->indexExists('comment_field_data', 'comment__status_comment_type'));