protected function SimplenewsTestBase::getLatestSubscriber in Simplenews 3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/SimplenewsTestBase.php \Drupal\Tests\simplenews\Functional\SimplenewsTestBase::getLatestSubscriber()
Returns the last created Subscriber.
Return value
\Drupal\simplenews\Entity\Subscriber|null The Subscriber entity, or NULL if there is none.
4 calls to SimplenewsTestBase::getLatestSubscriber()
- SimplenewsPersonalizationFormsTest::testDeleteAccount in tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Delete account, subscriptions deleted.
- SimplenewsPersonalizationFormsTest::testDisableAccount in tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Disable account, subscriptions inactive.
- SimplenewsPersonalizationFormsTest::testSynchronizeSubscribeRegister in tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Subscribe then register: fields updated, subscription remains unconfirmed.
- SimplenewsSubscribeTest::testDuplicate in tests/
src/ Functional/ SimplenewsSubscribeTest.php - Tests protection against duplicate subscribers.
File
- tests/
src/ Functional/ SimplenewsTestBase.php, line 269
Class
- SimplenewsTestBase
- Base class for simplenews web tests.
Namespace
Drupal\Tests\simplenews\FunctionalCode
protected function getLatestSubscriber() {
$snids = \Drupal::entityQuery('simplenews_subscriber')
->sort('created', 'DESC')
->range(0, 1)
->accessCheck(FALSE)
->execute();
return empty($snids) ? NULL : Subscriber::load(array_shift($snids));
}