DiffOpTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * @author Addshore
  4. *
  5. * @group Diff
  6. */
  7. class DiffOpTest extends MediaWikiTestCase {
  8. /**
  9. * @covers DiffOp::getType
  10. */
  11. public function testGetType() {
  12. $obj = new FakeDiffOp();
  13. $obj->type = 'foo';
  14. $this->assertEquals( 'foo', $obj->getType() );
  15. }
  16. /**
  17. * @covers DiffOp::getOrig
  18. */
  19. public function testGetOrig() {
  20. $obj = new FakeDiffOp();
  21. $obj->orig = [ 'foo' ];
  22. $this->assertEquals( [ 'foo' ], $obj->getOrig() );
  23. }
  24. /**
  25. * @covers DiffOp::getClosing
  26. */
  27. public function testGetClosing() {
  28. $obj = new FakeDiffOp();
  29. $obj->closing = [ 'foo' ];
  30. $this->assertEquals( [ 'foo' ], $obj->getClosing() );
  31. }
  32. /**
  33. * @covers DiffOp::getClosing
  34. */
  35. public function testGetClosingWithParameter() {
  36. $obj = new FakeDiffOp();
  37. $obj->closing = [ 'foo', 'bar', 'baz' ];
  38. $this->assertEquals( 'foo', $obj->getClosing( 0 ) );
  39. $this->assertEquals( 'bar', $obj->getClosing( 1 ) );
  40. $this->assertEquals( 'baz', $obj->getClosing( 2 ) );
  41. $this->assertEquals( null, $obj->getClosing( 3 ) );
  42. }
  43. /**
  44. * @covers DiffOp::norig
  45. */
  46. public function testNorig() {
  47. $obj = new FakeDiffOp();
  48. $this->assertEquals( 0, $obj->norig() );
  49. $obj->orig = [ 'foo' ];
  50. $this->assertEquals( 1, $obj->norig() );
  51. }
  52. /**
  53. * @covers DiffOp::nclosing
  54. */
  55. public function testNclosing() {
  56. $obj = new FakeDiffOp();
  57. $this->assertEquals( 0, $obj->nclosing() );
  58. $obj->closing = [ 'foo' ];
  59. $this->assertEquals( 1, $obj->nclosing() );
  60. }
  61. }