public function SimplenewsSourceTest::testSkip in Simplenews 3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/SimplenewsSourceTest.php \Drupal\Tests\simplenews\Functional\SimplenewsSourceTest::testSkip()
Test handling of the skip exception.
File
- tests/
src/ Functional/ SimplenewsSourceTest.php, line 439
Class
- SimplenewsSourceTest
- Test cases for creating and sending newsletters.
Namespace
Drupal\Tests\simplenews\FunctionalCode
public function testSkip() {
$this
->setUpSubscribers(1);
// Setting the body to "Nothing interesting" provokes an exception in
// simplenews_test_mail_alter().
$node = $this
->drupalCreateNode([
'body' => 'Nothing interesting',
'type' => 'simplenews_issue',
'simplenews_issue[target_id]' => [
'target_id' => 'default',
],
]);
\Drupal::service('simplenews.spool_storage')
->addIssue($node);
\Drupal::service('simplenews.mailer')
->sendSpool();
$this
->assertEqual(0, count($this
->getMails()));
$spool_row = \Drupal::database()
->select('simplenews_mail_spool', 'ms')
->fields('ms', [
'status',
])
->execute()
->fetchAssoc();
$this
->assertEqual(SpoolStorageInterface::STATUS_SKIPPED, $spool_row['status']);
}