3 namespace Drupal\Tests\node\Functional\Update;
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
9 * Tests that node settings are properly updated during database updates.
13 class NodeUpdateTest extends UpdatePathTestBase {
18 protected function setDatabaseDumpFiles() {
19 $this->databaseDumpFiles = [
20 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz',
25 * Tests that the node entity type has a 'published' entity key.
27 * @see node_update_8301()
29 public function testPublishedEntityKey() {
30 // Check that the 'published' entity key does not exist prior to the update.
31 $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('node');
32 $this->assertFalse($entity_type->getKey('published'));
37 // Check that the entity key exists and it has the correct value.
38 $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('node');
39 $this->assertEqual('status', $entity_type->getKey('published'));
43 * Tests that the node entity form has the status checkbox.
45 * @see node_post_update_configure_status_field_widget()
47 public function testStatusCheckbox() {
51 $query = \Drupal::entityQuery('entity_form_display')
52 ->condition('targetEntityType', 'node');
53 $ids = $query->execute();
54 $form_displays = EntityFormDisplay::loadMultiple($ids);
58 * @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display
60 foreach ($form_displays as $id => $form_display) {
61 $component = $form_display->getComponent('status');
62 $this->assertEqual('boolean_checkbox', $component['type']);
63 $this->assertEqual(['display_label' => TRUE], $component['settings']);