diff --git a/modules/simplenews_demo/simplenews_demo.info.yml b/modules/simplenews_demo/simplenews_demo.info.yml index c7c920d..eb00adf 100644 --- a/modules/simplenews_demo/simplenews_demo.info.yml +++ b/modules/simplenews_demo/simplenews_demo.info.yml @@ -1,6 +1,7 @@ description: Demo module for simplenews. core: 8.x dependencies: + - block - views - simplenews - simplenews_scheduler diff --git a/modules/simplenews_demo/src/Tests/SimplenewsDemoTest.php b/modules/simplenews_demo/src/Tests/SimplenewsDemoTest.php index bf237af..65f8cb9 100644 --- a/modules/simplenews_demo/src/Tests/SimplenewsDemoTest.php +++ b/modules/simplenews_demo/src/Tests/SimplenewsDemoTest.php @@ -6,15 +6,14 @@ namespace Drupal\simplenews_demo\Tests; -use Drupal\simplenews\Entity\Newsletter; -use Drupal\simplenews\Tests\SimplenewsTestBase; +use Drupal\search_api\Tests\WebTestBase; /** * Tests the demo module for Simplenews. * * @group simplenews */ -class SimplenewsDemoTest extends SimplenewsTestBase { +class SimplenewsDemoTest extends WebTestBase { /** * Modules to enable. @@ -28,7 +27,8 @@ class SimplenewsDemoTest extends SimplenewsTestBase { */ function setUp() { parent::setUp(); - $this->drupalLogin($this->drupalCreateUser(['administer simplenews subscriptions', 'administer newsletters', 'administer simplenews settings'])); + + $this->drupalLogin($this->drupalCreateUser(['administer simplenews subscriptions', 'send newsletter', 'administer newsletters', 'administer simplenews settings'])); } /** @@ -43,7 +43,21 @@ class SimplenewsDemoTest extends SimplenewsTestBase { $from_address = $this->xpath('//input[@id="edit-from-address"]')[0]; $this->assertEqual('Drupal', (string) $from_name['value']); $this->assertEqual('simpletest@example.com', (string) $from_address['value']); - // Assert demo newsletters + // Assert demo newsletters. + $this->drupalGet('/admin/config/services/simplenews'); + $this->assertText(t('Press releases')); + $this->assertText(t('Special offers')); + $this->assertText(t('Weekly content update')); + // Assert demo newsletters sent. + $this->drupalGet('/admin/content/simplenews'); + $this->assertRaw(t('Newsletter issue sent to 2 subscribers.')); + $this->assertRaw(t('Newsletter issue is pending, mails sent out of 3.')); + $this->assertRaw(t('Newsletter issue is pending, mails sent out of 1.')); + // Assert demo subscribers. + $this->drupalGet('/admin/people/simplenews'); + $this->assertText('a@example.com'); + $this->assertText('b@example.com'); + $this->assertText('demouser1@example.com'); } }