4 require_once __DIR__
. DIRECTORY_SEPARATOR
. 'FakeDiffOp.php';
8 * @author Adam Shorland
12 class DiffOpTest
extends MediaWikiTestCase
{
15 * @covers DiffOp::getType
17 public function testGetType() {
18 $obj = new FakeDiffOp();
20 $this->assertEquals( 'foo', $obj->getType() );
24 * @covers DiffOp::getOrig
26 public function testGetOrig() {
27 $obj = new FakeDiffOp();
28 $obj->orig
= array( 'foo' );
29 $this->assertEquals( array( 'foo' ), $obj->getOrig() );
33 * @covers DiffOp::getClosing
35 public function testGetClosing() {
36 $obj = new FakeDiffOp();
37 $obj->closing
= array( 'foo' );
38 $this->assertEquals( array( 'foo' ), $obj->getClosing() );
42 * @covers DiffOp::getClosing
44 public function testGetClosingWithParameter() {
45 $obj = new FakeDiffOp();
46 $obj->closing
= array( 'foo', 'bar', 'baz' );
47 $this->assertEquals( 'foo', $obj->getClosing( 0 ) );
48 $this->assertEquals( 'bar', $obj->getClosing( 1 ) );
49 $this->assertEquals( 'baz', $obj->getClosing( 2 ) );
50 $this->assertEquals( null, $obj->getClosing( 3 ) );
54 * @covers DiffOp::norig
56 public function testNorig() {
57 $obj = new FakeDiffOp();
58 $this->assertEquals( 0, $obj->norig() );
59 $obj->orig
= array( 'foo' );
60 $this->assertEquals( 1, $obj->norig() );
64 * @covers DiffOp::nclosing
66 public function testNclosing() {
67 $obj = new FakeDiffOp();
68 $this->assertEquals( 0, $obj->nclosing() );
69 $obj->closing
= array( 'foo' );
70 $this->assertEquals( 1, $obj->nclosing() );