コード例 #1
0
 public function testGetOpcodes()
 {
     $parser = m::mock('bariew\\FineDiff\\Parser\\Parser');
     $parser->shouldReceive('parse')->with('foobar', 'eggfooba')->once();
     $diff = new Diff(null, null, $parser);
     $diff->getOpcodes('foobar', 'eggfooba');
 }
コード例 #2
0
ファイル: SimpleTest.php プロジェクト: bariew/finediff
 public function testInsertParagraphGranularity()
 {
     list($from, $to, $opcodes, $html) = $this->getFile('paragraph/simple');
     $diff = new Diff(new Paragraph());
     $generated_opcodes = $diff->getOpcodes($from, $to);
     // Generate opcodes
     $this->assertEquals($generated_opcodes, $opcodes);
     // Render to text from opcodes
     $render = new Text();
     $this->assertEquals($render->process($from, $generated_opcodes), $to);
     // Render to html from opcodes
     $render = new Html();
     $this->assertEquals($render->process($from, $generated_opcodes), $html);
     // Render
     $this->assertEquals($diff->render($from, $to), $html);
 }