X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fuser%2FUserArrayFromResultTest.php;h=4cbfe462dd6aa8bc6e4f09c7b7240ecf32bc840e;hp=cf980b127849b64737dbae8ecd2b2d87e5d813d3;hb=15c27d356b5e6760024ac0653279a76d94d78b1f;hpb=939199bcea28a3b13c49c0f808d11d415660b924 diff --git a/tests/phpunit/includes/user/UserArrayFromResultTest.php b/tests/phpunit/includes/user/UserArrayFromResultTest.php index cf980b1278..4cbfe462dd 100644 --- a/tests/phpunit/includes/user/UserArrayFromResultTest.php +++ b/tests/phpunit/includes/user/UserArrayFromResultTest.php @@ -7,7 +7,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase { private function getMockResultWrapper( $row = null, $numRows = 1 ) { - $resultWrapper = $this->getMockBuilder( 'ResultWrapper' ) + $resultWrapper = $this->getMockBuilder( Wikimedia\Rdbms\ResultWrapper::class ) ->disableOriginalConstructor(); $resultWrapper = $resultWrapper->getMock(); @@ -27,10 +27,6 @@ class UserArrayFromResultTest extends MediaWikiTestCase { return $row; } - private function getUserArrayFromResult( $resultWrapper ) { - return new UserArrayFromResult( $resultWrapper ); - } - /** * @covers UserArrayFromResult::__construct */ @@ -38,7 +34,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase { $row = false; $resultWrapper = $this->getMockResultWrapper( $row ); - $object = $this->getUserArrayFromResult( $resultWrapper ); + $object = new UserArrayFromResult( $resultWrapper ); $this->assertEquals( $resultWrapper, $object->res ); $this->assertSame( 0, $object->key ); @@ -53,11 +49,11 @@ class UserArrayFromResultTest extends MediaWikiTestCase { $row = $this->getRowWithUsername( $username ); $resultWrapper = $this->getMockResultWrapper( $row ); - $object = $this->getUserArrayFromResult( $resultWrapper ); + $object = new UserArrayFromResult( $resultWrapper ); $this->assertEquals( $resultWrapper, $object->res ); $this->assertSame( 0, $object->key ); - $this->assertInstanceOf( 'User', $object->current ); + $this->assertInstanceOf( User::class, $object->current ); $this->assertEquals( $username, $object->current->mName ); } @@ -74,7 +70,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase { * @covers UserArrayFromResult::count */ public function testCountWithVaryingValues( $numRows ) { - $object = $this->getUserArrayFromResult( $this->getMockResultWrapper( + $object = new UserArrayFromResult( $this->getMockResultWrapper( $this->getRowWithUsername(), $numRows ) ); @@ -87,8 +83,8 @@ class UserArrayFromResultTest extends MediaWikiTestCase { public function testCurrentAfterConstruction() { $username = 'addshore'; $userRow = $this->getRowWithUsername( $username ); - $object = $this->getUserArrayFromResult( $this->getMockResultWrapper( $userRow ) ); - $this->assertInstanceOf( 'User', $object->current() ); + $object = new UserArrayFromResult( $this->getMockResultWrapper( $userRow ) ); + $this->assertInstanceOf( User::class, $object->current() ); $this->assertEquals( $username, $object->current()->mName ); } @@ -104,7 +100,7 @@ class UserArrayFromResultTest extends MediaWikiTestCase { * @covers UserArrayFromResult::valid */ public function testValid( $input, $expected ) { - $object = $this->getUserArrayFromResult( $this->getMockResultWrapper( $input ) ); + $object = new UserArrayFromResult( $this->getMockResultWrapper( $input ) ); $this->assertEquals( $expected, $object->valid() ); }