| 1 |
<?php |
| 2 |
|
| 3 |
namespace Wikimedia\Tests\Diff; |
| 4 |
|
| 5 |
use MediaWikiUnitTestCase; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class DiffOpTest extends MediaWikiUnitTestCase { |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
public function testGetType() { |
| 18 |
$obj = new FakeDiffOp(); |
| 19 |
$obj->type = 'foo'; |
| 20 |
$this->assertSame( 'foo', $obj->getType() ); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
public function testGetOrig() { |
| 27 |
$obj = new FakeDiffOp(); |
| 28 |
$obj->orig = [ 'foo' ]; |
| 29 |
$this->assertSame( [ 'foo' ], $obj->getOrig() ); |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public function testGetClosing() { |
| 36 |
$obj = new FakeDiffOp(); |
| 37 |
$obj->closing = [ 'foo' ]; |
| 38 |
$this->assertSame( [ 'foo' ], $obj->getClosing() ); |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
public function testGetClosingWithParameter() { |
| 45 |
$obj = new FakeDiffOp(); |
| 46 |
$obj->closing = [ 'foo', 'bar', 'baz' ]; |
| 47 |
$this->assertSame( 'foo', $obj->getClosing( 0 ) ); |
| 48 |
$this->assertSame( 'bar', $obj->getClosing( 1 ) ); |
| 49 |
$this->assertSame( 'baz', $obj->getClosing( 2 ) ); |
| 50 |
$this->assertNull( $obj->getClosing( 3 ) ); |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public function testNorig() { |
| 57 |
$obj = new FakeDiffOp(); |
| 58 |
$this->assertSame( 0, $obj->norig() ); |
| 59 |
$obj->orig = [ 'foo' ]; |
| 60 |
$this->assertSame( 1, $obj->norig() ); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
public function testNclosing() { |
| 67 |
$obj = new FakeDiffOp(); |
| 68 |
$this->assertSame( 0, $obj->nclosing() ); |
| 69 |
$obj->closing = [ 'foo' ]; |
| 70 |
$this->assertSame( 1, $obj->nclosing() ); |
| 71 |
} |
| 72 |
|
| 73 |
} |