Differential D7355 Diff 16606 src/applications/metamta/view/__tests__/PhabricatorMetaMTAMailBodyTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/view/__tests__/PhabricatorMetaMTAMailBodyTestCase.php
| <?php | <?php | ||||
| /** | /** | ||||
| * @group metamta | * @group metamta | ||||
| */ | */ | ||||
| final class PhabricatorMetaMTAMailBodyTestCase extends PhabricatorTestCase { | final class PhabricatorMetaMTAMailBodyTestCase extends PhabricatorTestCase { | ||||
| public function testBodyRender() { | public function testBodyRender() { | ||||
| $expect = <<<EOTEXT | $expect = <<<EOTEXT | ||||
| salmon | salmon | ||||
| HEADER | HEADER | ||||
| bass | bass | ||||
| trout | trout | ||||
| MANAGE HERALD RULES | |||||
| http://test.com/rules/ | |||||
| WHY DID I GET THIS EMAIL? | WHY DID I GET THIS EMAIL? | ||||
| http://test.com/xscript/ | http://test.com/xscript/ | ||||
| REPLY HANDLER ACTIONS | REPLY HANDLER ACTIONS | ||||
| pike | pike | ||||
| EOTEXT; | EOTEXT; | ||||
| Show All 21 Lines | EOTEXT; | ||||
| public function testBodyRenderNoReply() { | public function testBodyRenderNoReply() { | ||||
| $expect = <<<EOTEXT | $expect = <<<EOTEXT | ||||
| salmon | salmon | ||||
| HEADER | HEADER | ||||
| bass | bass | ||||
| trout | trout | ||||
| MANAGE HERALD RULES | |||||
| http://test.com/rules/ | |||||
| WHY DID I GET THIS EMAIL? | WHY DID I GET THIS EMAIL? | ||||
| http://test.com/xscript/ | http://test.com/xscript/ | ||||
| EOTEXT; | EOTEXT; | ||||
| $this->assertEmail($expect, true, false); | $this->assertEmail($expect, true, false); | ||||
| } | } | ||||
| private function assertEmail($expect, $herald_hints, $reply_hints) { | private function assertEmail($expect, $herald_hints, $reply_hints) { | ||||
| $env = PhabricatorEnv::beginScopedEnv(); | $env = PhabricatorEnv::beginScopedEnv(); | ||||
| $env->overrideEnvConfig('phabricator.production-uri', 'http://test.com/'); | $env->overrideEnvConfig('phabricator.production-uri', 'http://test.com/'); | ||||
| $env->overrideEnvConfig('metamta.herald.show-hints', $herald_hints); | $env->overrideEnvConfig('metamta.herald.show-hints', $herald_hints); | ||||
| $env->overrideEnvConfig('metamta.reply.show-hints', $reply_hints); | $env->overrideEnvConfig('metamta.reply.show-hints', $reply_hints); | ||||
| $body = new PhabricatorMetaMTAMailBody(); | $body = new PhabricatorMetaMTAMailBody(); | ||||
| $body->addRawSection("salmon"); | $body->addRawSection("salmon"); | ||||
| $body->addTextSection("HEADER", "bass\ntrout\n"); | $body->addTextSection("HEADER", "bass\ntrout\n"); | ||||
| $body->addHeraldSection("/rules/", "/xscript/"); | $body->addHeraldSection("/xscript/"); | ||||
| $body->addReplySection("pike"); | $body->addReplySection("pike"); | ||||
| $this->assertEqual($expect, $body->render()); | $this->assertEqual($expect, $body->render()); | ||||
| } | } | ||||
| } | } | ||||