You are here

protected function UniqueFieldAjaxBase::createBasicUpdateData in Unique field ajax 2.x

Helper method to create the basic update edit data.

Parameters

string|null $title: Optional language title otherwise will be randomly generated.

string|null $body: Optional language body otherwise will be randomly generated.

Return value

string[] Edit data formatted for submit.

8 calls to UniqueFieldAjaxBase::createBasicUpdateData()
UniqueFieldAjaxBase::createUpdateFieldData in tests/src/Functional/UniqueFieldAjaxBase.php
Helper method to create custom update edit data for fields.
UniqueFieldAjaxLanguageTest::testUniqueTitlePerLang in tests/src/Functional/UniqueFieldAjaxLanguageTest.php
Tests unique title per language.
UniqueFieldAjaxTest::testUniqueTitleAllowsSavingSameField in tests/src/Functional/UniqueFieldAjaxTest.php
Test if title unique is enabled you can still save the same node.
UniqueFieldAjaxTest::testUniqueTitleCustomMessage in tests/src/Functional/UniqueFieldAjaxTest.php
Tests unique title custom message.
UniqueFieldAjaxTest::testUniqueTitleCustomMessageWithLabelToken in tests/src/Functional/UniqueFieldAjaxTest.php
Tests unique title custom message with an added label token.

... See full list

File

tests/src/Functional/UniqueFieldAjaxBase.php, line 366

Class

UniqueFieldAjaxBase
The base testing class for unique_field_ajax.

Namespace

Drupal\Tests\unique_field_ajax\Functional

Code

protected function createBasicUpdateData(string $title = NULL, string $body = NULL) : array {
  $return = [];
  $return['title[0][value]'] = $title ?? $this
    ->randomMachineName();
  $return['body[0][value]'] = $body ?? $this
    ->randomMachineName();
  return $return;
}