function PasswordItemTest::testPreSaveExceptionNew
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php \Drupal\KernelTests\Core\Field\FieldType\PasswordItemTest::testPreSaveExceptionNew()
- 11.x core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php \Drupal\KernelTests\Core\Field\FieldType\PasswordItemTest::testPreSaveExceptionNew()
@covers ::preSave
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Field/ FieldType/ PasswordItemTest.php, line 165
Class
- PasswordItemTest
- @coversDefaultClass \Drupal\Core\Field\Plugin\Field\FieldType\PasswordItem @group Field
Namespace
Drupal\KernelTests\Core\Field\FieldTypeCode
public function testPreSaveExceptionNew() {
$entity = EntityTest::create();
$entity->test_field = str_repeat('a', PasswordInterface::PASSWORD_MAX_LENGTH + 1);
$this->expectException(EntityStorageException::class);
$this->expectExceptionMessage('The entity does not have a password');
$entity->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.