public function UniqueFieldAjaxTest::testUniqueFieldAllowsSavingSameField in Unique field ajax 2.x
Test if field unique is enabled you can still save the same node.
Throws
\Drupal\Core\Entity\EntityStorageException
\Behat\Mink\Exception\ResponseTextException
File
- tests/
src/ Functional/ UniqueFieldAjaxTest.php, line 59
Class
- UniqueFieldAjaxTest
- Test the field permissions report page.
Namespace
Drupal\Tests\unique_field_ajax\FunctionalCode
public function testUniqueFieldAllowsSavingSameField() {
foreach ($this->fieldTypes as $field_type) {
$this
->createField($field_type['type'], $field_type['widget'], $field_type['settings']);
$field_name = $this->fieldStorage
->getName();
// Field does not get triggered as unique if edited and saved.
// We create a new one and then update it twice.
$this
->updateThirdPartyFieldSetting('unique', TRUE);
$edit = $this
->createUpdateFieldData($field_name, $field_type['value'], $field_type['effect']);
$id = $this
->itCanSaveField($edit);
$this
->itCanUpdateField($edit, $id);
$this
->itCanUpdateField($edit, $id);
}
}