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