You are here

protected function FunctionalTestBase::editEntityBundle in Entity Construction Kit (ECK) 8

Edits a bundle for a given entity type.

Parameters

string $entity_type: The entity type to add the bundle for.

string $bundle: The bundle type.

string $label: The bundle label.

array $title_overrides: A key / value array of title overrides.

Return value

array The machine name and label of the new bundle.

Throws

\Behat\Mink\Exception\ExpectationException

1 call to FunctionalTestBase::editEntityBundle()
BundleCRUDTest::singleBundleEditWithOverrides in tests/src/Functional/BundleCRUDTest.php
Tests single bundle edit with title overrides.

File

tests/src/Functional/FunctionalTestBase.php, line 157

Class

FunctionalTestBase
Provides common functionality for ECK functional tests.

Namespace

Drupal\Tests\eck\Functional

Code

protected function editEntityBundle($entity_type, $bundle, $label, $title_overrides = []) {
  $this
    ->drupalGet(Url::fromRoute("entity.{$entity_type}_type.edit_form", [
    "{$entity_type}_type" => $bundle,
  ]));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $edit = [
    'name' => $label,
  ];
  foreach ($title_overrides as $field => $title_override) {
    $edit[$field . '_title_override'] = $title_override;
  }
  $this
    ->submitForm($edit, 'Save bundle');
  $this
    ->assertSession()
    ->responseContains("The entity bundle <em class=\"placeholder\">{$label}</em> has been updated.");
}