diff options
author | Máté Szabó <mszabo@wikia-inc.com> | 2019-06-30 15:23:53 +0200 |
---|---|---|
committer | Máté Szabó <mszabo@wikia-inc.com> | 2019-06-30 15:23:53 +0200 |
commit | 344481f60d92ac9295129c5089c0fe467ff497b9 (patch) | |
tree | db19c9c01b006294ef684340f27e8942aca79d24 /tests/phpunit/unit/includes/diff/DiffOpTest.php | |
parent | e93b90e4290093e3165c66338db24c7dbe84cf48 (diff) | |
download | mediawikicore-344481f60d92ac9295129c5089c0fe467ff497b9.tar.gz mediawikicore-344481f60d92ac9295129c5089c0fe467ff497b9.zip |
Move trivially compatible tests to the unit tests suite
This changeset resumes work on T89432 and related tickets
by porting an initial set of tests to the new unit test suite
separated out in I69b92db3e70093570e05cc0a64c7780a278b321a.
The tests were only ported if they worked immediately without
requiring any changes other than changing the test case class
to MediaWikiUnitTestCase and moving the test to the new suite.
If a test failed for any reason (even trivial misconfiguration),
it was NOT ported.
With this change, the unit tests suite now consits of a total
of 455 tests. As before, you can run these tests via the following
command:
$ composer phpunit:unit
Bug: T84948
Bug: T89432
Bug: T87781
Change-Id: Ibb8175981092d7f41864e641cc3c118af70a5c76
Diffstat (limited to 'tests/phpunit/unit/includes/diff/DiffOpTest.php')
-rw-r--r-- | tests/phpunit/unit/includes/diff/DiffOpTest.php | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/phpunit/unit/includes/diff/DiffOpTest.php b/tests/phpunit/unit/includes/diff/DiffOpTest.php new file mode 100644 index 000000000000..4e1aced7a6d4 --- /dev/null +++ b/tests/phpunit/unit/includes/diff/DiffOpTest.php @@ -0,0 +1,68 @@ +<?php +/** + * @author Addshore + * + * @group Diff + */ +class DiffOpTest extends \MediaWikiUnitTestCase { + + /** + * @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(); + $obj->orig = [ 'foo' ]; + $this->assertEquals( [ 'foo' ], $obj->getOrig() ); + } + + /** + * @covers DiffOp::getClosing + */ + public function testGetClosing() { + $obj = new FakeDiffOp(); + $obj->closing = [ 'foo' ]; + $this->assertEquals( [ 'foo' ], $obj->getClosing() ); + } + + /** + * @covers DiffOp::getClosing + */ + public function testGetClosingWithParameter() { + $obj = new FakeDiffOp(); + $obj->closing = [ 'foo', 'bar', 'baz' ]; + $this->assertEquals( 'foo', $obj->getClosing( 0 ) ); + $this->assertEquals( 'bar', $obj->getClosing( 1 ) ); + $this->assertEquals( 'baz', $obj->getClosing( 2 ) ); + $this->assertEquals( null, $obj->getClosing( 3 ) ); + } + + /** + * @covers DiffOp::norig + */ + public function testNorig() { + $obj = new FakeDiffOp(); + $this->assertEquals( 0, $obj->norig() ); + $obj->orig = [ 'foo' ]; + $this->assertEquals( 1, $obj->norig() ); + } + + /** + * @covers DiffOp::nclosing + */ + public function testNclosing() { + $obj = new FakeDiffOp(); + $this->assertEquals( 0, $obj->nclosing() ); + $obj->closing = [ 'foo' ]; + $this->assertEquals( 1, $obj->nclosing() ); + } + +} |