You are here

class SimplenewsSourceTest in Simplenews 7

Same name and namespace in other branches
  1. 7.2 includes/simplenews.source.inc \SimplenewsSourceTest

Example source implementation used for tests.

Hierarchy

Expanded class hierarchy of SimplenewsSourceTest

Related topics

File

includes/simplenews.source.inc, line 959
Contains SimplenewsSource interface and implementations.

View source
class SimplenewsSourceTest implements SimplenewsSourceInterface {
  protected $format;
  public function __construct($format) {
    $this->format = $format;
  }
  public function getAttachments() {
    return array(
      array(
        'uri' => 'example://test.png',
        'filemime' => 'x-example',
        'filename' => 'test.png',
      ),
    );
  }
  public function getBody() {
    return $this
      ->getFormat() == 'plain' ? $this
      ->getPlainBody() : 'the body';
  }
  public function getFooter() {
    return $this
      ->getFormat() == 'plain' ? $this
      ->getPlainFooter() : 'the footer';
  }
  public function getPlainFooter() {
    return 'the plain footer';
  }
  public function getFormat() {
    return $this->format;
  }
  public function getFromAddress() {
    return 'test@example.org';
  }
  public function getFromFormatted() {
    return 'Test <test@example.org>';
  }
  public function getHeaders(array $headers) {
    $headers['X-Simplenews-Test'] = 'OK';
    return $headers;
  }
  public function getKey() {
    return 'node';
  }
  public function getLanguage() {
    return 'en';
  }
  public function getPlainBody() {
    return 'the plain body';
  }
  public function getRecipient() {
    return 'recipient@example.org';
  }
  public function getSubject() {
    return 'the subject';
  }
  public function getTokenContext() {
    return array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SimplenewsSourceTest::$format protected property
SimplenewsSourceTest::getAttachments public function Returns an array of attachments for this newsletter mail. Overrides SimplenewsSourceInterface::getAttachments
SimplenewsSourceTest::getBody public function Returns the mail body. Overrides SimplenewsSourceInterface::getBody
SimplenewsSourceTest::getFooter public function Returns the mail footer. Overrides SimplenewsSourceInterface::getFooter
SimplenewsSourceTest::getFormat public function Returns the mail format. Overrides SimplenewsSourceInterface::getFormat
SimplenewsSourceTest::getFromAddress public function Returns the plain mail address. Overrides SimplenewsSourceInterface::getFromAddress
SimplenewsSourceTest::getFromFormatted public function Returns the formatted from mail address. Overrides SimplenewsSourceInterface::getFromFormatted
SimplenewsSourceTest::getHeaders public function Returns the mail headers. Overrides SimplenewsSourceInterface::getHeaders
SimplenewsSourceTest::getKey public function Returns the mail key to be used for drupal_mail(). Overrides SimplenewsSourceInterface::getKey
SimplenewsSourceTest::getLanguage public function The language that should be used for this newsletter mail. Overrides SimplenewsSourceInterface::getLanguage
SimplenewsSourceTest::getPlainBody public function Returns the plaintext body. Overrides SimplenewsSourceInterface::getPlainBody
SimplenewsSourceTest::getPlainFooter public function Returns the plain footer. Overrides SimplenewsSourceInterface::getPlainFooter
SimplenewsSourceTest::getRecipient public function Returns the recipent of this newsletter mail. Overrides SimplenewsSourceInterface::getRecipient
SimplenewsSourceTest::getSubject public function Returns the mail subject. Overrides SimplenewsSourceInterface::getSubject
SimplenewsSourceTest::getTokenContext public function Returns the token context to be used with token replacements. Overrides SimplenewsSourceInterface::getTokenContext
SimplenewsSourceTest::__construct public function