2014-02-26 21:47:40 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
2016-01-27 09:59:31 +00:00
|
|
|
* @author Addshore
|
2014-02-26 21:47:40 +00:00
|
|
|
*
|
|
|
|
|
* @group Diff
|
|
|
|
|
*/
|
|
|
|
|
class DiffOpTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers DiffOp::getType
|
|
|
|
|
*/
|
|
|
|
|
public function testGetType() {
|
|
|
|
|
$obj = new FakeDiffOp();
|
|
|
|
|
$obj->type = 'foo';
|
|
|
|
|
$this->assertEquals( 'foo', $obj->getType() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers DiffOp::getOrig
|
|
|
|
|
*/
|
|
|
|
|
public function testGetOrig() {
|
|
|
|
|
$obj = new FakeDiffOp();
|
2016-02-17 09:09:32 +00:00
|
|
|
$obj->orig = [ 'foo' ];
|
|
|
|
|
$this->assertEquals( [ 'foo' ], $obj->getOrig() );
|
2014-02-26 21:47:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers DiffOp::getClosing
|
|
|
|
|
*/
|
|
|
|
|
public function testGetClosing() {
|
|
|
|
|
$obj = new FakeDiffOp();
|
2016-02-17 09:09:32 +00:00
|
|
|
$obj->closing = [ 'foo' ];
|
|
|
|
|
$this->assertEquals( [ 'foo' ], $obj->getClosing() );
|
2014-02-26 21:47:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers DiffOp::getClosing
|
|
|
|
|
*/
|
|
|
|
|
public function testGetClosingWithParameter() {
|
|
|
|
|
$obj = new FakeDiffOp();
|
2016-02-17 09:09:32 +00:00
|
|
|
$obj->closing = [ 'foo', 'bar', 'baz' ];
|
2014-03-20 18:59:20 +00:00
|
|
|
$this->assertEquals( 'foo', $obj->getClosing( 0 ) );
|
|
|
|
|
$this->assertEquals( 'bar', $obj->getClosing( 1 ) );
|
|
|
|
|
$this->assertEquals( 'baz', $obj->getClosing( 2 ) );
|
|
|
|
|
$this->assertEquals( null, $obj->getClosing( 3 ) );
|
2014-02-26 21:47:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers DiffOp::norig
|
|
|
|
|
*/
|
|
|
|
|
public function testNorig() {
|
|
|
|
|
$obj = new FakeDiffOp();
|
|
|
|
|
$this->assertEquals( 0, $obj->norig() );
|
2016-02-17 09:09:32 +00:00
|
|
|
$obj->orig = [ 'foo' ];
|
2014-02-26 21:47:40 +00:00
|
|
|
$this->assertEquals( 1, $obj->norig() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @covers DiffOp::nclosing
|
|
|
|
|
*/
|
|
|
|
|
public function testNclosing() {
|
|
|
|
|
$obj = new FakeDiffOp();
|
|
|
|
|
$this->assertEquals( 0, $obj->nclosing() );
|
2016-02-17 09:09:32 +00:00
|
|
|
$obj->closing = [ 'foo' ];
|
2014-02-26 21:47:40 +00:00
|
|
|
$this->assertEquals( 1, $obj->nclosing() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|