You are here

public function SchedulerFieldsDisplayTest::testManageFormDisplay in Scheduler 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/SchedulerFieldsDisplayTest.php \Drupal\Tests\scheduler\Functional\SchedulerFieldsDisplayTest::testManageFormDisplay()

Tests the settings entry in the content type form display.

This test covers scheduler_entity_extra_field_info().

@dataProvider dataStandardEntityTypes()

File

tests/src/Functional/SchedulerFieldsDisplayTest.php, line 151

Class

SchedulerFieldsDisplayTest
Tests the display of date entry fields and form elements.

Namespace

Drupal\Tests\scheduler\Functional

Code

public function testManageFormDisplay($entityTypeId, $bundle) {
  $this
    ->drupalLogin($this->adminUser);
  $entityType = $this
    ->entityTypeObject($entityTypeId, $bundle);

  // Check that the weight input field is displayed when the entity bundle is
  // enabled for scheduling. This field still exists even with tabledrag on.
  $form_display_url = Url::fromRoute("entity.entity_form_display.{$entityTypeId}.default", [
    $entityType
      ->getEntityTypeId() => $bundle,
  ]);
  $this
    ->drupalGet($form_display_url);
  $this
    ->assertSession()
    ->fieldExists('edit-fields-scheduler-settings-weight');

  // Check that the weight input field is not displayed when the entity bundle
  // is not enabled for scheduling.
  $this
    ->entityTypeObject($entityTypeId, $bundle)
    ->setThirdPartySetting('scheduler', 'publish_enable', FALSE)
    ->setThirdPartySetting('scheduler', 'unpublish_enable', FALSE)
    ->save();
  $this
    ->drupalGet($form_display_url);
  $this
    ->assertSession()
    ->pageTextContains('Manage form display');
  $this
    ->assertSession()
    ->FieldNotExists('edit-fields-scheduler-settings-weight');
}