gluon-web-remote

Web remote Administration for big size of gluon routers
git clone git://archive.git.mtrnord.blog/MTRNord/gluon-web-remote.git
Log | Files | Refs | README

ParserTest.php (1549B)


      1 <?php
      2 /*
      3  * This file is part of the Diff package.
      4  *
      5  * (c) Sebastian Bergmann <sebastian@phpunit.de>
      6  *
      7  * For the full copyright and license information, please view the LICENSE
      8  * file that was distributed with this source code.
      9  */
     10 
     11 namespace SebastianBergmann\Diff;
     12 
     13 use PHPUnit_Framework_TestCase;
     14 
     15 class ParserTest extends PHPUnit_Framework_TestCase
     16 {
     17     /**
     18      * @var Parser
     19      */
     20     private $parser;
     21 
     22     protected function setUp()
     23     {
     24         $this->parser = new Parser;
     25     }
     26 
     27     public function testParse()
     28     {
     29         $content = file_get_contents(__DIR__ . '/fixtures/patch.txt');
     30 
     31         $diffs = $this->parser->parse($content);
     32 
     33         $this->assertCount(1, $diffs);
     34 
     35         $chunks = $diffs[0]->getChunks();
     36         $this->assertCount(1, $chunks);
     37 
     38         $this->assertEquals(20, $chunks[0]->getStart());
     39 
     40         $this->assertCount(5, $chunks[0]->getLines());
     41     }
     42 
     43     public function testParseWithMultipleChunks()
     44     {
     45         $content = file_get_contents(__DIR__ . '/fixtures/patch2.txt');
     46 
     47         $diffs = $this->parser->parse($content);
     48 
     49         $this->assertCount(1, $diffs);
     50 
     51         $chunks = $diffs[0]->getChunks();
     52         $this->assertCount(3, $chunks);
     53 
     54         $this->assertEquals(20, $chunks[0]->getStart());
     55         $this->assertEquals(320, $chunks[1]->getStart());
     56         $this->assertEquals(600, $chunks[2]->getStart());
     57 
     58         $this->assertCount(5, $chunks[0]->getLines());
     59         $this->assertCount(5, $chunks[1]->getLines());
     60         $this->assertCount(5, $chunks[2]->getLines());
     61     }
     62 }