If the load() triggered by User method calls fails, then mId becomes 0
which means there is no "user" right set in getAutomaticGroups().
Bug: T75174
Change-Id: I2d719e4b96c0142e9d408aa2d4f7c5e7a767a754
* @param string|bool $error False if no error expected
*/
public function testAssert( $registered, $rights, $assert, $error ) {
* @param string|bool $error False if no error expected
*/
public function testAssert( $registered, $rights, $assert, $error ) {
+ $user = $this->getMutableTestUser()->getUser();
+ $user->load(); // load before setting mRights
+ } else {
+ $user = new User();
}
$user->mRights = $rights;
try {
}
$user->mRights = $rights;
try {
], null, null, $user );
$this->assertFalse( $error ); // That no error was expected
} catch ( ApiUsageException $e ) {
], null, null, $user );
$this->assertFalse( $error ); // That no error was expected
} catch ( ApiUsageException $e ) {
- $this->assertTrue( self::apiExceptionHasCode( $e, $error ) );
+ $this->assertTrue( self::apiExceptionHasCode( $e, $error ),
+ "Error '{$e->getMessage()}' matched expected '$error'" );