You are here

protected function EmbeddedScheduledUpdateTypeTestBase::checkAfterTypeCreated in Scheduled Updates 8

Parameters

string $label:

string $type_id:

string $reference_field_label:

string $reference_field_name:

$clone_field:

Throws

\Behat\Mink\Exception\DriverException

\Behat\Mink\Exception\ElementNotFoundException

\Behat\Mink\Exception\ExpectationException

\Behat\Mink\Exception\ResponseTextException

\Behat\Mink\Exception\UnsupportedDriverActionException

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Drupal\Core\Entity\EntityStorageException

\Exception

2 calls to EmbeddedScheduledUpdateTypeTestBase::checkAfterTypeCreated()
AddFieldScheduledUpdateTypeTest::checkAddUpdateField in tests/src/FunctionalJavascript/AddFieldScheduledUpdateTypeTest.php
Test to check from manage fields on Node.
EmbeddedScheduledUpdateTypeTest::createType in tests/src/FunctionalJavascript/EmbeddedScheduledUpdateTypeTest.php
Create a scheduled update type via the UI.

File

tests/src/FunctionalJavascript/EmbeddedScheduledUpdateTypeTestBase.php, line 409
Contains \Drupal\Tests\scheduled_updates\EmbeddedScheduledUpdateTypeTestBase.

Class

EmbeddedScheduledUpdateTypeTestBase
Base test class for embedded update types.

Namespace

Drupal\Tests\scheduled_updates\FunctionalJavascript

Code

protected function checkAfterTypeCreated($label, $type_id, $reference_field_label, $reference_field_name, $clone_field) {
  $permissions = [
    "create {$type_id} scheduled updates",
    'administer scheduled updates',
  ];

  // Check both permissions tha will allow the user to create updates.
  foreach ($permissions as $permission) {

    // Give permission to create the current update type.
    $this
      ->grantPermissionsToUser([
      $permission,
    ]);
    $this
      ->confirmNoAddForm($label, $type_id);
    $this
      ->checkReferenceCreated('node', 'page', $reference_field_label, $reference_field_name);
    $this
      ->checkReferenceOnEntityType('node', 'page', $reference_field_label, $reference_field_name);
    switch ($clone_field) {
      case 'title':
        $this
          ->checkRunningTitleUpdates('page', $reference_field_name, $reference_field_label);
        break;
      case 'promote':
        $this
          ->checkRunningPromoteUpdates('page', $reference_field_name, $reference_field_label);
        break;
    }
    $this
      ->revokePermissionsFromUser([
      $permission,
    ]);
  }
}