You are here

protected function SmsFrameworkTestTrait::getLastVerification in SMS Framework 8

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

Gets the last phone number verification that was created.

Return value

\Drupal\sms\Entity\PhoneNumberVerificationInterface|false The last verification created, or FALSE if no verifications exist.

9 calls to SmsFrameworkTestTrait::getLastVerification()
SmsFrameworkPhoneNumberTest::testPhoneNumberVerificationMessage in tests/src/Functional/SmsFrameworkPhoneNumberTest.php
Ensure phone number verification SMS sent.
SmsFrameworkPhoneNumberVerificationTest::testGetPhoneVerificationByCode in tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php
Tests get verification by code.
SmsFrameworkPhoneNumberVerificationTest::testNewPhoneVerification in tests/src/Kernel/SmsFrameworkPhoneNumberVerificationTest.php
Tests creating new verification for an entity.
SmsFrameworkPhoneNumberVerifyForm::testVerifyForm in tests/src/Functional/SmsFrameworkPhoneNumberVerifyForm.php
Test phone number verification form.
SmsFrameworkPhoneNumberWidgetTest::testPhoneNumberWidget in tests/src/Functional/SmsFrameworkPhoneNumberWidgetTest.php
Test telephone widget using entity form.

... See full list

File

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

Class

SmsFrameworkTestTrait
Shared SMS Framework helpers for kernel and web tests.

Namespace

Drupal\Tests\sms\Functional

Code

protected function getLastVerification() {
  $verification_storage = \Drupal::entityTypeManager()
    ->getStorage('sms_phone_number_verification');
  $verification_ids = $verification_storage
    ->getQuery()
    ->sort('created', 'DESC')
    ->range(0, 1)
    ->execute();
  $verifications = $verification_storage
    ->loadMultiple($verification_ids);
  return reset($verifications);
}