public function SmsFrameworkPhoneNumberWidgetTest::testPhoneNumberPurgedFieldValueOnExpiration in SMS Framework 2.1.x
Same name and namespace in other branches
- 8 tests/src/Functional/SmsFrameworkPhoneNumberWidgetTest.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberWidgetTest::testPhoneNumberPurgedFieldValueOnExpiration()
- 2.x tests/src/Functional/SmsFrameworkPhoneNumberWidgetTest.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberWidgetTest::testPhoneNumberPurgedFieldValueOnExpiration()
Test behaviour of widget with phone number purge setting.
File
- tests/
src/ Functional/ SmsFrameworkPhoneNumberWidgetTest.php, line 114
Class
- SmsFrameworkPhoneNumberWidgetTest
- Tests phone numbers.
Namespace
Drupal\Tests\sms\FunctionalCode
public function testPhoneNumberPurgedFieldValueOnExpiration() {
$phone_number_settings = $this
->createPhoneNumberSettings('entity_test', 'entity_test');
$phone_number_settings
->setPurgeVerificationPhoneNumber(TRUE)
->save();
$test_entity = $this
->createEntityWithPhoneNumber($phone_number_settings, [
'+123123123',
]);
// Force verification code to expire.
$this
->getLastVerification()
->set('created', time() - ($phone_number_settings
->getVerificationCodeLifetime() + 1))
->save();
$this
->cronRun();
// Ensure phone number value was removed from the field.
$this
->drupalGet($test_entity
->toUrl('edit-form'));
$field_phone_number = $phone_number_settings
->getFieldName('phone_number');
$this
->assertFieldByName($field_phone_number . '[0][value]', '');
}