You are here

public function DsTestTrait::dsCreateTokenField in Display Suite 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/DsTestTrait.php \Drupal\Tests\ds\Functional\DsTestTrait::dsCreateTokenField()

Create a token field.

Parameters

array $edit: An optional array of field properties.

string $url: The url to post to.

4 calls to DsTestTrait::dsCreateTokenField()
CacheTagsTest::testUserCacheTags in tests/src/Functional/CacheTagsTest.php
Tests setting the correct cache tags.
DsTestTrait::entitiesTestSetup in tests/src/Functional/DsTestTrait.php
Utility function to setup for all kinds of tests.
DynamicFieldPluginTest::testDsFields in tests/src/Functional/DynamicFieldPluginTest.php
Test Display fields.
LayoutClassesTest::testDsTestLayouts in tests/src/Functional/LayoutClassesTest.php
Test selecting layouts, classes, region to block and fields.

File

tests/src/Functional/DsTestTrait.php, line 117

Class

DsTestTrait
Provides common functionality for the Display Suite test classes.

Namespace

Drupal\Tests\ds\Functional

Code

public function dsCreateTokenField(array $edit = [], $url = 'admin/structure/ds/fields/manage_token') {
  $edit += [
    'name' => 'Test field',
    'id' => 'test_field',
    'entities[node]' => '1',
    'content[value]' => 'Test field',
  ];
  $this
    ->drupalGet($url);
  $this
    ->submitForm($edit, 'Save');
  $text = t('The field %name has been saved', [
    '%name' => $edit['name'],
  ]);
  $this
    ->assertSession()
    ->responseContains((string) $text);
}