f40683f6c1756a7cb9bd1c32acb75d2e7383d12c
[yaffs-website] / web / core / modules / comment / tests / src / Functional / Update / CommentHostnameUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\comment\Functional\Update;
4
5 use Drupal\comment\Entity\Comment;
6 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
7
8 /**
9  * Tests that comment hostname settings are properly updated.
10  *
11  * @group comment
12  * @group legacy
13  */
14 class CommentHostnameUpdateTest extends UpdatePathTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   protected function setDatabaseDumpFiles() {
20     $this->databaseDumpFiles = [
21       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz',
22     ];
23   }
24
25   /**
26    * Tests comment_update_8600().
27    *
28    * @see comment_update_8600
29    */
30   public function testCommentUpdate8600() {
31     /** @var \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface $manager */
32     $manager = $this->container->get('entity.definition_update_manager');
33
34     /** @var \Drupal\Core\Field\BaseFieldDefinition $definition */
35     $definition = $manager->getFieldStorageDefinition('hostname', 'comment');
36     // Check that 'hostname' base field doesn't have a default value callback.
37     $this->assertNull($definition->getDefaultValueCallback());
38
39     $this->runUpdates();
40
41     $definition = $manager->getFieldStorageDefinition('hostname', 'comment');
42     // Check that 'hostname' base field default value callback was set.
43     $this->assertEquals(Comment::class . '::getDefaultHostname', $definition->getDefaultValueCallback());
44   }
45
46 }