function NodeUpdateTest::testStatusCheckbox

Tests that the node entity form has the status checkbox.

See also

node_post_update_configure_status_field_widget()

File

core/modules/node/tests/src/Functional/Update/NodeUpdateTest.php, line 48

Class

NodeUpdateTest
Tests that node settings are properly updated during database updates.

Namespace

Drupal\Tests\node\Functional\Update

Code

public function testStatusCheckbox() {
    // Run updates.
    $this->runUpdates();
    $query = \Drupal::entityQuery('entity_form_display')->condition('targetEntityType', 'node');
    $ids = $query->execute();
    $form_displays = EntityFormDisplay::loadMultiple($ids);
    
    /**
     * @var string $id
     * @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display
     */
    foreach ($form_displays as $id => $form_display) {
        $component = $form_display->getComponent('status');
        $this->assertEqual('boolean_checkbox', $component['type']);
        $this->assertEqual([
            'display_label' => TRUE,
        ], $component['settings']);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.