ChunkTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. namespace SebastianBergmann\Diff;
  11. use PHPUnit\Framework\TestCase;
  12. /**
  13. * @covers SebastianBergmann\Diff\Chunk
  14. */
  15. class ChunkTest extends TestCase
  16. {
  17. /**
  18. * @var Chunk
  19. */
  20. private $chunk;
  21. protected function setUp()
  22. {
  23. $this->chunk = new Chunk;
  24. }
  25. public function testCanBeCreatedWithoutArguments()
  26. {
  27. $this->assertInstanceOf('SebastianBergmann\Diff\Chunk', $this->chunk);
  28. }
  29. public function testStartCanBeRetrieved()
  30. {
  31. $this->assertEquals(0, $this->chunk->getStart());
  32. }
  33. public function testStartRangeCanBeRetrieved()
  34. {
  35. $this->assertEquals(1, $this->chunk->getStartRange());
  36. }
  37. public function testEndCanBeRetrieved()
  38. {
  39. $this->assertEquals(0, $this->chunk->getEnd());
  40. }
  41. public function testEndRangeCanBeRetrieved()
  42. {
  43. $this->assertEquals(1, $this->chunk->getEndRange());
  44. }
  45. public function testLinesCanBeRetrieved()
  46. {
  47. $this->assertEquals(array(), $this->chunk->getLines());
  48. }
  49. public function testLinesCanBeSet()
  50. {
  51. $this->assertEquals(array(), $this->chunk->getLines());
  52. $testValue = array('line0', 'line1');
  53. $this->chunk->setLines($testValue);
  54. $this->assertEquals($testValue, $this->chunk->getLines());
  55. }
  56. }