예제 #1
0
    /**
     * @test
     *
     */
    function itShouldExecuteAndReturnInTextFormatWithoutDelOrInsert()
    {
        $diff = new Diff();
        $diff->setStringOne(<<<EOF
one
two
three
EOF
);
        $diff->setStringTwo(<<<EOF
one
two
three
EOF
);
        $diff->execute();
        $result = $diff->getResult();
        $format = new XML($result);
        $format->execute();
        $result = $format->getResult();
        $expect = <<<EOF
<?xml version="1.0" encoding="UTF-8" ?>
<data>
<line>one</line>
<line>two</line>
<line>three</line>
</data>
EOF;
        $this->assertEquals($expect, $result);
    }
예제 #2
0
    /**
     * @test
     *
     */
    function itShouldExecuteAndReturnInTextFormatWithoutDelOrInsert()
    {
        $diff = new Diff();
        $diff->setStringOne(<<<EOF
one
two
three
EOF
);
        $diff->setStringTwo(<<<EOF
one
two
three
EOF
);
        $diff->execute();
        $result = $diff->getResult();
        $format = new Text($result);
        $format->execute();
        $result = $format->getResult();
        $expect = <<<EOF
one
two
three
EOF;
        $this->assertEquals($expect, $result);
    }
예제 #3
0
    /**
     * @test
     *
     */
    function itShouldDiffSimple()
    {
        $diff = new Diff();
        $diff->setStringOne(<<<EOF
one
two
three
EOF
);
        $diff->setStringTwo(<<<EOF
one
two
threes
six
EOF
);
        $diff->execute();
        $result = $diff->getResult();
        $expect = [['l' => 'one'], ['l' => 'two'], ['-' => 'three'], ['+' => 'threes'], ['+' => 'six']];
        $this->assertEquals($expect, $result);
    }