1<?php 2/* 3 * This file is part of sebastian/diff. 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 11namespace SebastianBergmann\Diff; 12 13use PHPUnit\Framework\TestCase; 14 15/** 16 * @covers SebastianBergmann\Diff\Diff 17 * 18 * @uses SebastianBergmann\Diff\Chunk 19 */ 20final class DiffTest extends TestCase 21{ 22 public function testGettersAfterConstructionWithDefault() 23 { 24 $from = 'line1a'; 25 $to = 'line2a'; 26 $diff = new Diff($from, $to); 27 28 $this->assertSame($from, $diff->getFrom()); 29 $this->assertSame($to, $diff->getTo()); 30 $this->assertSame(array(), $diff->getChunks(), 'Expect chunks to be default value "array()".'); 31 } 32 33 public function testGettersAfterConstructionWithChunks() 34 { 35 $from = 'line1b'; 36 $to = 'line2b'; 37 $chunks = array(new Chunk(), new Chunk(2, 3)); 38 39 $diff = new Diff($from, $to, $chunks); 40 41 $this->assertSame($from, $diff->getFrom()); 42 $this->assertSame($to, $diff->getTo()); 43 $this->assertSame($chunks, $diff->getChunks(), 'Expect chunks to be passed value.'); 44 } 45 46 public function testSetChunksAfterConstruction() 47 { 48 $diff = new Diff('line1c', 'line2c'); 49 $this->assertSame(array(), $diff->getChunks(), 'Expect chunks to be default value "array()".'); 50 51 $chunks = array(new Chunk(), new Chunk(2, 3)); 52 $diff->setChunks($chunks); 53 $this->assertSame($chunks, $diff->getChunks(), 'Expect chunks to be passed value.'); 54 } 55} 56