설명 없음

ChunkTest.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php declare(strict_types=1);
  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. final class ChunkTest extends TestCase
  16. {
  17. /**
  18. * @var Chunk
  19. */
  20. private $chunk;
  21. protected function setUp(): void
  22. {
  23. $this->chunk = new Chunk;
  24. }
  25. public function testHasInitiallyNoLines(): void
  26. {
  27. $this->assertSame([], $this->chunk->getLines());
  28. }
  29. public function testCanBeCreatedWithoutArguments(): void
  30. {
  31. $this->assertInstanceOf(Chunk::class, $this->chunk);
  32. }
  33. public function testStartCanBeRetrieved(): void
  34. {
  35. $this->assertSame(0, $this->chunk->getStart());
  36. }
  37. public function testStartRangeCanBeRetrieved(): void
  38. {
  39. $this->assertSame(1, $this->chunk->getStartRange());
  40. }
  41. public function testEndCanBeRetrieved(): void
  42. {
  43. $this->assertSame(0, $this->chunk->getEnd());
  44. }
  45. public function testEndRangeCanBeRetrieved(): void
  46. {
  47. $this->assertSame(1, $this->chunk->getEndRange());
  48. }
  49. public function testLinesCanBeRetrieved(): void
  50. {
  51. $this->assertSame([], $this->chunk->getLines());
  52. }
  53. public function testLinesCanBeSet(): void
  54. {
  55. $lines = [new Line(Line::ADDED, 'added'), new Line(Line::REMOVED, 'removed')];
  56. $this->chunk->setLines($lines);
  57. $this->assertSame($lines, $this->chunk->getLines());
  58. }
  59. }