Esempio n. 1
0
 /**
  * Tests whether op classes returned by DiffEngine::diff() match expectations.
  *
  * @covers ::diff
  * @dataProvider provideTestDiff
  */
 public function testDiff($expected, $from, $to)
 {
     $diff_engine = new DiffEngine();
     $diff = $diff_engine->diff($from, $to);
     // Make sure we have the same number of results as expected.
     $this->assertCount(count($expected), $diff);
     // Make sure the diff objects match our expectations.
     foreach ($expected as $index => $op_class) {
         $this->assertEquals($op_class, get_class($diff[$index]));
     }
 }
Esempio n. 2
0
 /**
  * Constructor.
  * Computes diff between sequences of strings.
  *
  * @param $from_lines array An array of strings.
  *      (Typically these are lines from a file.)
  * @param $to_lines array An array of strings.
  */
 public function __construct($from_lines, $to_lines)
 {
     $eng = new DiffEngine();
     $this->edits = $eng->diff($from_lines, $to_lines);
     //$this->_check($from_lines, $to_lines);
 }