You are here

protected function SmsFrameworkTestTrait::verifyPhoneNumber in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::verifyPhoneNumber()
  2. 2.1.x tests/src/Functional/SmsFrameworkTestTrait.php \Drupal\Tests\sms\Functional\SmsFrameworkTestTrait::verifyPhoneNumber()

Forces verification of a phone number for an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: An entity to verify phone number.

string $phone_number: A phone number.

8 calls to SmsFrameworkTestTrait::verifyPhoneNumber()
SmsBlastBrowserTest::testSendBlast in modules/sms_blast/tests/src/Functional/SmsBlastBrowserTest.php
Tests sending SMS blast.
SmsFrameworkPhoneNumberProviderTest::testGetPhoneNumbersVerified in tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php
Tests phone numbers.
SmsFrameworkPhoneNumberProviderTest::testSendMessageOneMessage in tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php
Ensure default behaviour is to send one phone number per entity.
SmsFrameworkPhoneNumberProviderTest::testSendMessageVerified in tests/src/Kernel/SmsFrameworkPhoneNumberProviderTest.php
Tests SMS message sent to entities with verified phone number.
SmsFrameworkPhoneNumberVerificationTest::testGetPhoneVerificationByPhoneNumberVerified in tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php
Tests get verification by phone number with verified option.

... See full list

File

tests/src/Functional/SmsFrameworkTestTrait.php, line 239

Class

SmsFrameworkTestTrait
Shared SMS Framework helpers for kernel and web tests.

Namespace

Drupal\Tests\sms\Functional

Code

protected function verifyPhoneNumber(EntityInterface $entity, $phone_number) {
  $verifications = \Drupal::entityTypeManager()
    ->getStorage('sms_phone_number_verification')
    ->loadByProperties([
    'entity__target_type' => $entity
      ->getEntityTypeId(),
    'entity__target_id' => $entity
      ->id(),
    'phone' => $phone_number,
  ]);
  $verification = reset($verifications);
  $verification
    ->setStatus(TRUE)
    ->save();
}