public function MobileNumberFieldTest::createMobileNumberNode in Mobile Number 8
Same name and namespace in other branches
- 2.0.x src/Tests/MobileNumberFieldTest.php \Drupal\mobile_number\Tests\MobileNumberFieldTest::createMobileNumberNode()
Create node with mobile number(s).
2 calls to MobileNumberFieldTest::createMobileNumberNode()
- MobileNumberFieldTest::testNumberUniqueness in src/
Tests/ MobileNumberFieldTest.php - Test number validation.
- MobileNumberFieldTest::testVerification in src/
Tests/ MobileNumberFieldTest.php - Test number verification.
File
- src/
Tests/ MobileNumberFieldTest.php, line 260
Class
- MobileNumberFieldTest
- Mobile number field functionality.'.
Namespace
Drupal\mobile_number\TestsCode
public function createMobileNumberNode($name, $number, $verified, $verified2 = NULL) {
$values = [];
$values["field_{$name}"][0] = [
'mobile' => $number,
'country-code' => 'IL',
];
$mobile_number = $this->util
->getMobileNumber($number);
if ($verified) {
$values["field_{$name}"][0]['verification_code'] = $code = $this->util
->generateVerificationCode();
$values["field_{$name}"][0]['verification_token'] = $this->util
->registerVerificationCode($mobile_number, $code);
}
if (isset($verified2)) {
$values["field_{$name}"][1] = [
'mobile' => $number,
'country-code' => 'IL',
];
if ($verified2) {
$values["field_{$name}"][1]['verification_code'] = $code = $this->util
->generateVerificationCode();
$values["field_{$name}"][1]['verification_token'] = $this->util
->registerVerificationCode($mobile_number, $code);
}
}
return $this
->submitNodeForm($name, $values, $number);
}