You are here

public function SmsFrameworkPhoneNumberVerificationTest::testGetPhoneVerificationByPhoneNumberVerified in SMS Framework 8

Same name and namespace in other branches
  1. 2.x tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberVerificationTest::testGetPhoneVerificationByPhoneNumberVerified()
  2. 2.1.x tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php \Drupal\Tests\sms\Kernel\SmsFrameworkPhoneNumberVerificationTest::testGetPhoneVerificationByPhoneNumberVerified()

Tests get verification by phone number with verified option.

@covers ::getPhoneVerificationByPhoneNumber

File

tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php, line 186

Class

SmsFrameworkPhoneNumberVerificationTest
Tests Phone Number Provider.

Namespace

Drupal\Tests\sms\Kernel

Code

public function testGetPhoneVerificationByPhoneNumberVerified() {
  $phone_number1 = '+123123123';
  $phone_number2 = '+456456456';
  $entity = $this
    ->createEntityWithPhoneNumber($this->phoneNumberSettings, [
    $phone_number1,
    $phone_number2,
  ]);
  $this
    ->verifyPhoneNumber($entity, $phone_number2);
  $return = $this->phoneNumberVerificationProvider
    ->getPhoneVerificationByPhoneNumber($phone_number1, TRUE);
  $this
    ->assertEquals(0, count($return));
  $return = $this->phoneNumberVerificationProvider
    ->getPhoneVerificationByPhoneNumber($phone_number1, FALSE);
  $this
    ->assertEquals(1, count($return));
  $return = $this->phoneNumberVerificationProvider
    ->getPhoneVerificationByPhoneNumber($phone_number2, FALSE);
  $this
    ->assertEquals(0, count($return));
  $return = $this->phoneNumberVerificationProvider
    ->getPhoneVerificationByPhoneNumber($phone_number2, TRUE);
  $this
    ->assertEquals(1, count($return));
}