Differential D9405 Diff 23024 src/applications/differential/mail/__tests__/DifferentialReplyHandlerTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/mail/__tests__/DifferentialReplyHandlerTestCase.php
- This file was added.
<?php | |||||
final class DifferentialReplyHandlerTestCase extends PhabricatorTestCase { | |||||
public function testExtractCommand() { | |||||
$handler = new DifferentialReplyHandler(); | |||||
list($command, $body) = $handler->extractCommand("!reject\ntext"); | |||||
$this->assertEqual('reject', $command); | |||||
$this->assertEqual('text', $body); | |||||
list($command, $body) = $handler->extractCommand('!reject'); | |||||
$this->assertEqual('reject', $command); | |||||
$this->assertEqual('', $body); | |||||
list($command, $body) = $handler->extractCommand("hello\n!reject"); | |||||
$this->assertEqual('reject', $command); | |||||
$this->assertEqual('hello', $body); | |||||
list($command, $body) = | |||||
$handler->extractCommand('just chatting about !reject'); | |||||
$this->assertEqual(DifferentialAction::ACTION_COMMENT, $command); | |||||
$this->assertEqual('just chatting about !reject', $body); | |||||
list($command, $body) = $handler->extractCommand('!reject is awesome'); | |||||
$this->assertEqual(DifferentialAction::ACTION_COMMENT, $command); | |||||
$this->assertEqual('!reject is awesome', $body); | |||||
list($command, $body) = $handler->extractCommand('what about !reject ?'); | |||||
$this->assertEqual(DifferentialAction::ACTION_COMMENT, $command); | |||||
$this->assertEqual('what about !reject ?', $body); | |||||
list($command, $body) = $handler->extractCommand(" !reject\nso awesome"); | |||||
$this->assertEqual('reject', $command); | |||||
$this->assertEqual('so awesome', $body); | |||||
} | |||||
} |