diff options
author | Thiemo Kreuz <thiemo.kreuz@wikimedia.de> | 2021-11-02 08:59:20 +0100 |
---|---|---|
committer | Thiemo Kreuz (WMDE) <thiemo.kreuz@wikimedia.de> | 2021-11-02 09:43:03 +0000 |
commit | ee0f97378b899aa6f8aafcb16bbe724c9b479724 (patch) | |
tree | 4db86ac89fc95fdfde3d9116be24d57edcd79133 /tests/phpunit/integration/includes/user | |
parent | 0bfe17ad12d5ed8956659506c4b8f2d2c540dc3f (diff) | |
download | mediawikicore-ee0f97378b899aa6f8aafcb16bbe724c9b479724.tar.gz mediawikicore-ee0f97378b899aa6f8aafcb16bbe724c9b479724.zip |
Replace `new stdClass` with more compact array syntax
It does the exact same. The resulting object is still an stdClass
instance.
Change-Id: Ief68609943ee30aa95732d24021c921dfbad166c
Diffstat (limited to 'tests/phpunit/integration/includes/user')
-rw-r--r-- | tests/phpunit/integration/includes/user/UserRightsProxyTest.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/phpunit/integration/includes/user/UserRightsProxyTest.php b/tests/phpunit/integration/includes/user/UserRightsProxyTest.php index d3882a976702..b55cd818a757 100644 --- a/tests/phpunit/integration/includes/user/UserRightsProxyTest.php +++ b/tests/phpunit/integration/includes/user/UserRightsProxyTest.php @@ -5,7 +5,6 @@ namespace MediaWiki\Tests\User; use MediaWiki\User\UserGroupManager; use MediaWiki\User\UserGroupManagerFactory; use MediaWikiIntegrationTestCase; -use stdClass; use UserRightsProxy; use Wikimedia\Rdbms\ILoadBalancer; use Wikimedia\Rdbms\LBFactory; @@ -27,9 +26,10 @@ class UserRightsProxyTest extends MediaWikiIntegrationTestCase { $dbMock = $this->createMock( MaintainableDBConnRef::class ); - $row = new stdClass; - $row->user_name = 'UserRightsProxyTest'; - $row->user_id = 12345; + $row = (object)[ + 'user_name' => 'UserRightsProxyTest', + 'user_id' => 12345, + ]; $dbMock->method( 'selectRow' )->willReturn( $row ); $lbMock = $this->createMock( ILoadBalancer::class ); @@ -138,7 +138,7 @@ class UserRightsProxyTest extends MediaWikiIntegrationTestCase { $userGroupManagerMock ->expects( $this->once() ) ->method( 'getUserGroupMemberships' ) - ->willReturn( [ 'bot' => new stdClass, 'sysop' => new stdClass ] ); + ->willReturn( [ 'bot' => (object)[], 'sysop' => (object)[] ] ); $userGroupManagerFactoryMock = $this->createMock( UserGroupManagerFactory::class ); $userGroupManagerFactoryMock ->method( 'getUserGroupManager' ) @@ -161,7 +161,7 @@ class UserRightsProxyTest extends MediaWikiIntegrationTestCase { $userGroupManagerMock2 ->expects( $this->exactly( 2 ) ) ->method( 'getUserGroupMemberships' ) - ->willReturn( [ 'bot' => new stdClass ] ); + ->willReturn( [ 'bot' => (object)[] ] ); $userGroupManagerFactoryMock2 = $this->createMock( UserGroupManagerFactory::class ); $userGroupManagerFactoryMock2 ->method( 'getUserGroupManager' ) @@ -184,9 +184,10 @@ class UserRightsProxyTest extends MediaWikiIntegrationTestCase { $value = 'bar'; $dbMock = $this->createMock( MaintainableDBConnRef::class ); - $row = new stdClass; - $row->user_name = 'UserRightsProxyTest'; - $row->user_id = 12345; + $row = (object)[ + 'user_name' => 'UserRightsProxyTest', + 'user_id' => 12345, + ]; $dbMock->method( 'selectRow' )->willReturn( $row ); $dbMock->method( 'timestamp' )->willReturn( 'timestamp' ); $dbMock->method( 'getDomainID' )->willReturn( 'foowiki' ); |