[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/metamta/view/__tests__/ -> PhabricatorMetaMTAMailBodyTestCase.php (source)

   1  <?php
   2  
   3  final class PhabricatorMetaMTAMailBodyTestCase extends PhabricatorTestCase {
   4  
   5    public function testBodyRender() {
   6      $expect = <<<EOTEXT
   7  salmon
   8  
   9  HEADER
  10    bass
  11    trout
  12  
  13  WHY DID I GET THIS EMAIL?
  14    http://test.com/xscript/
  15  
  16  REPLY HANDLER ACTIONS
  17    pike
  18  
  19  EOTEXT;
  20  
  21      $this->assertEmail($expect, true, true);
  22    }
  23  
  24    public function testBodyRenderNoHerald() {
  25      $expect = <<<EOTEXT
  26  salmon
  27  
  28  HEADER
  29    bass
  30    trout
  31  
  32  REPLY HANDLER ACTIONS
  33    pike
  34  
  35  EOTEXT;
  36  
  37      $this->assertEmail($expect, false, true);
  38    }
  39  
  40  
  41    public function testBodyRenderNoReply() {
  42      $expect = <<<EOTEXT
  43  salmon
  44  
  45  HEADER
  46    bass
  47    trout
  48  
  49  WHY DID I GET THIS EMAIL?
  50    http://test.com/xscript/
  51  
  52  EOTEXT;
  53  
  54      $this->assertEmail($expect, true, false);
  55    }
  56  
  57    private function assertEmail($expect, $herald_hints, $reply_hints) {
  58      $env = PhabricatorEnv::beginScopedEnv();
  59      $env->overrideEnvConfig('phabricator.production-uri', 'http://test.com/');
  60      $env->overrideEnvConfig('metamta.herald.show-hints', $herald_hints);
  61      $env->overrideEnvConfig('metamta.reply.show-hints', $reply_hints);
  62  
  63      $body = new PhabricatorMetaMTAMailBody();
  64      $body->addRawSection('salmon');
  65      $body->addTextSection('HEADER', "bass\ntrout\n");
  66      $body->addHeraldSection('/xscript/');
  67      $body->addReplySection('pike');
  68  
  69      $this->assertEqual($expect, $body->render());
  70    }
  71  
  72  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1