DiffOpTest.php 907 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Drupal\Tests\Component\Diff\Engine;
  3. use Drupal\Component\Diff\Engine\DiffOp;
  4. use PHPUnit\Framework\TestCase;
  5. use PHPUnit\Framework\Error\Error;
  6. /**
  7. * Test DiffOp base class.
  8. *
  9. * The only significant behavior here is that ::reverse() should throw an error
  10. * if not overridden. In versions of this code in other projects, reverse() is
  11. * marked as abstract, which enforces some of this behavior.
  12. *
  13. * @coversDefaultClass \Drupal\Component\Diff\Engine\DiffOp
  14. *
  15. * @group Diff
  16. */
  17. class DiffOpTest extends TestCase {
  18. /**
  19. * DiffOp::reverse() always throws an error.
  20. *
  21. * @covers ::reverse
  22. */
  23. public function testReverse() {
  24. if (method_exists($this, 'expectException')) {
  25. $this->expectException(Error::class);
  26. }
  27. else {
  28. $this->setExpectedException(\PHPUnit_Framework_Error::class);
  29. }
  30. $op = new DiffOp();
  31. $result = $op->reverse();
  32. }
  33. }