public function SmsFrameworkPhoneNumberTest::testPhoneNumberVerificationCreated in SMS Framework 8
Same name and namespace in other branches
- 2.x tests/src/Functional/SmsFrameworkPhoneNumberTest.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberTest::testPhoneNumberVerificationCreated()
- 2.1.x tests/src/Functional/SmsFrameworkPhoneNumberTest.php \Drupal\Tests\sms\Functional\SmsFrameworkPhoneNumberTest::testPhoneNumberVerificationCreated()
Test verification code creation on entity postsave.
See also
File
- tests/
src/ Functional/ SmsFrameworkPhoneNumberTest.php, line 34
Class
- SmsFrameworkPhoneNumberTest
- General phone number verification tests.
Namespace
Drupal\Tests\sms\FunctionalCode
public function testPhoneNumberVerificationCreated() {
$phone_number_settings = $this
->createPhoneNumberSettings('entity_test', 'entity_test');
$phone_numbers = [
'+123123123',
'+456456456',
'+789789789',
];
for ($quantity = 1; $quantity < 3; $quantity++) {
$test_entity = $this
->createEntityWithPhoneNumber($phone_number_settings, array_slice($phone_numbers, 0, $quantity));
$this
->assertEqual($quantity, $this
->countVerificationCodes($test_entity), 'There is ' . $quantity . ' verification code.');
// Ensure post-save did not create verification codes if one already
// exists.
$test_entity
->save();
$this
->assertEqual($quantity, $this
->countVerificationCodes($test_entity), 'Additional verification codes were not created.');
}
}