b8b30be4f1e786c350200ed7e16f09c371a1af27
[yaffs-website] / web / core / modules / node / src / Tests / Update / NodeUpdateTest.php
1 <?php
2
3 namespace Drupal\node\Tests\Update;
4
5 use Drupal\system\Tests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests that node settings are properly updated during database updates.
9  *
10  * @group node
11  */
12 class NodeUpdateTest extends UpdatePathTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function setDatabaseDumpFiles() {
18     $this->databaseDumpFiles = [
19       __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz',
20     ];
21   }
22
23   /**
24    * Tests that the node entity type has a 'published' entity key.
25    *
26    * @see node_update_8301()
27    */
28   public function testPublishedEntityKey() {
29     // Check that the 'published' entity key does not exist prior to the update.
30     $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('node');
31     $this->assertFalse($entity_type->getKey('published'));
32
33     // Run updates.
34     $this->runUpdates();
35
36     // Check that the entity key exists and it has the correct value.
37     $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('node');
38     $this->assertEqual('status', $entity_type->getKey('published'));
39   }
40
41 }