Merge "Remove button styles from mediawiki.ui"
[lhc/web/wiklou.git] / tests / phpunit / includes / diff / DiffOpTest.php
1 <?php
2
3 //Load our FakeDiffOp
4 require_once __DIR__ . DIRECTORY_SEPARATOR . 'FakeDiffOp.php';
5
6 /**
7 * @licence GNU GPL v2+
8 * @author Adam Shorland
9 *
10 * @group Diff
11 */
12 class DiffOpTest extends MediaWikiTestCase {
13
14 /**
15 * @covers DiffOp::getType
16 */
17 public function testGetType() {
18 $obj = new FakeDiffOp();
19 $obj->type = 'foo';
20 $this->assertEquals( 'foo', $obj->getType() );
21 }
22
23 /**
24 * @covers DiffOp::getOrig
25 */
26 public function testGetOrig() {
27 $obj = new FakeDiffOp();
28 $obj->orig = array( 'foo' );
29 $this->assertEquals( array( 'foo' ), $obj->getOrig() );
30 }
31
32 /**
33 * @covers DiffOp::getClosing
34 */
35 public function testGetClosing() {
36 $obj = new FakeDiffOp();
37 $obj->closing = array( 'foo' );
38 $this->assertEquals( array( 'foo' ), $obj->getClosing() );
39 }
40
41 /**
42 * @covers DiffOp::getClosing
43 */
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 ) );
51 }
52
53 /**
54 * @covers DiffOp::norig
55 */
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() );
61 }
62
63 /**
64 * @covers DiffOp::nclosing
65 */
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() );
71 }
72
73 }