[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/differential/parser/__tests__/ -> DifferentialCustomFieldRevertsParserTestCase.php (source)

   1  <?php
   2  
   3  final class DifferentialCustomFieldRevertsParserTestCase
   4    extends PhabricatorTestCase {
   5  
   6    public function testParser() {
   7      $map = array(
   8        'quack quack quack' => array(),
   9  
  10        // Git default message.
  11        'This reverts commit 1234abcd.' => array(
  12          array(
  13            'match' => 'reverts commit 1234abcd',
  14            'prefix' => 'reverts',
  15            'infix' => 'commit',
  16            'monograms' => array('1234abcd'),
  17            'suffix' => '',
  18            'offset' => 5,
  19          ),
  20        ),
  21  
  22        // Mercurial default message.
  23        'Backed out changeset 1234abcd.' => array(
  24          array(
  25            'match' => 'Backed out changeset 1234abcd',
  26            'prefix' => 'Backed out',
  27            'infix' => 'changeset',
  28            'monograms' => array('1234abcd'),
  29            'suffix' => '',
  30            'offset' => 0,
  31          ),
  32        ),
  33  
  34        'this undoes 1234abcd, 5678efab. they were bad' => array(
  35          array(
  36            'match' => 'undoes 1234abcd, 5678efab',
  37            'prefix' => 'undoes',
  38            'infix' => '',
  39            'monograms' => array('1234abcd', '5678efab'),
  40            'suffix' => '',
  41            'offset' => 5,
  42          ),
  43        ),
  44  
  45        'Reverts 123' => array(
  46          array(
  47            'match' => 'Reverts 123',
  48            'prefix' => 'Reverts',
  49            'infix' => '',
  50            'monograms' => array('123'),
  51            'suffix' => '',
  52            'offset' => 0,
  53          ),
  54        ),
  55  
  56  
  57        'Reverts r123' => array(
  58          array(
  59            'match' => 'Reverts r123',
  60            'prefix' => 'Reverts',
  61            'infix' => '',
  62            'monograms' => array('r123'),
  63            'suffix' => '',
  64            'offset' => 0,
  65          ),
  66        ),
  67  
  68        "Backs out commit\n99\n100" => array(
  69          array(
  70            'match' => "Backs out commit\n99\n100",
  71            'prefix' => 'Backs out',
  72            'infix' => 'commit',
  73            'monograms' => array('99', '100'),
  74            'suffix' => '',
  75            'offset' => 0,
  76          ),
  77        ),
  78  
  79        "This doesn't revert anything" => array(),
  80        'nonrevert of r11' => array(),
  81        'fixed a bug' => array(),
  82      );
  83  
  84      foreach ($map as $input => $expect) {
  85        $parser = new DifferentialCustomFieldRevertsParser();
  86        $output = $parser->parseCorpus($input);
  87  
  88        $this->assertEqual($expect, $output, $input);
  89      }
  90    }
  91  
  92  }


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