X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FTitleArrayFromResultTest.php;h=32c757101aa9d9c497a17d7290a7a300af016cc9;hb=fa2561e9e7c26f4e0f7212fdb1d643a40ee1b920;hp=88822140488f5d5e9f2c5e9ecfc85faecc049c92;hpb=f036c5b324e2b2d240edf8d5eeb7fc2af3d88c47;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/TitleArrayFromResultTest.php b/tests/phpunit/includes/TitleArrayFromResultTest.php index 8882214048..32c757101a 100644 --- a/tests/phpunit/includes/TitleArrayFromResultTest.php +++ b/tests/phpunit/includes/TitleArrayFromResultTest.php @@ -4,12 +4,12 @@ * @author Addshore * @covers TitleArrayFromResult */ -class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { +class TitleArrayFromResultTest extends PHPUnit\Framework\TestCase { use MediaWikiCoversValidator; private function getMockResultWrapper( $row = null, $numRows = 1 ) { - $resultWrapper = $this->getMockBuilder( 'ResultWrapper' ) + $resultWrapper = $this->getMockBuilder( Wikimedia\Rdbms\ResultWrapper::class ) ->disableOriginalConstructor(); $resultWrapper = $resultWrapper->getMock(); @@ -30,10 +30,6 @@ class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { return $row; } - private function getTitleArrayFromResult( $resultWrapper ) { - return new TitleArrayFromResult( $resultWrapper ); - } - /** * @covers TitleArrayFromResult::__construct */ @@ -41,7 +37,7 @@ class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { $row = false; $resultWrapper = $this->getMockResultWrapper( $row ); - $object = $this->getTitleArrayFromResult( $resultWrapper ); + $object = new TitleArrayFromResult( $resultWrapper ); $this->assertEquals( $resultWrapper, $object->res ); $this->assertSame( 0, $object->key ); @@ -57,11 +53,11 @@ class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { $row = $this->getRowWithTitle( $namespace, $title ); $resultWrapper = $this->getMockResultWrapper( $row ); - $object = $this->getTitleArrayFromResult( $resultWrapper ); + $object = new TitleArrayFromResult( $resultWrapper ); $this->assertEquals( $resultWrapper, $object->res ); $this->assertSame( 0, $object->key ); - $this->assertInstanceOf( 'Title', $object->current ); + $this->assertInstanceOf( Title::class, $object->current ); $this->assertEquals( $namespace, $object->current->mNamespace ); $this->assertEquals( $title, $object->current->mTextform ); } @@ -79,7 +75,7 @@ class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { * @covers TitleArrayFromResult::count */ public function testCountWithVaryingValues( $numRows ) { - $object = $this->getTitleArrayFromResult( $this->getMockResultWrapper( + $object = new TitleArrayFromResult( $this->getMockResultWrapper( $this->getRowWithTitle(), $numRows ) ); @@ -93,8 +89,8 @@ class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { $namespace = 0; $title = 'foo'; $row = $this->getRowWithTitle( $namespace, $title ); - $object = $this->getTitleArrayFromResult( $this->getMockResultWrapper( $row ) ); - $this->assertInstanceOf( 'Title', $object->current() ); + $object = new TitleArrayFromResult( $this->getMockResultWrapper( $row ) ); + $this->assertInstanceOf( Title::class, $object->current() ); $this->assertEquals( $namespace, $object->current->mNamespace ); $this->assertEquals( $title, $object->current->mTextform ); } @@ -111,7 +107,7 @@ class TitleArrayFromResultTest extends PHPUnit_Framework_TestCase { * @covers TitleArrayFromResult::valid */ public function testValid( $input, $expected ) { - $object = $this->getTitleArrayFromResult( $this->getMockResultWrapper( $input ) ); + $object = new TitleArrayFromResult( $this->getMockResultWrapper( $input ) ); $this->assertEquals( $expected, $object->valid() ); }