protected function SimplenewsTestBase::getLatestSubscriber in Simplenews 8
Returns the last created Subscriber.
Return value
\Drupal\simplenews\Entity\Subscriber|null The Subscriber entity, or NULL if there is none.
3 calls to SimplenewsTestBase::getLatestSubscriber()
- SimplenewsPersonalizationFormsTest::testDeleteAccount in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Delete account, subscriptions deleted.
- SimplenewsPersonalizationFormsTest::testDisableAccount in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Disable account, subscriptions inactive.
- SimplenewsPersonalizationFormsTest::testSynchronizeSubscribeRegister in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Subscribe then register: fields updated, subscription remains unconfirmed.
File
- src/
Tests/ SimplenewsTestBase.php, line 246 - Simplenews test functions.
Class
- SimplenewsTestBase
- Base class for simplenews web tests.
Namespace
Drupal\simplenews\TestsCode
protected function getLatestSubscriber() {
$snids = \Drupal::entityQuery('simplenews_subscriber')
->sort('created', 'DESC')
->range(0, 1)
->execute();
return empty($snids) ? NULL : Subscriber::load(array_shift($snids));
}