23 if ( !is_null( $block ) ) {
34 $user = User::newFromName(
'UTApiBlockee' );
36 if ( $user->getId() == 0 ) {
37 $user->addToDatabase();
40 $user->saveSettings();
55 $user = User::newFromName(
'UTApiBlockee' );
57 if ( !$user->getId() ) {
58 $this->markTestIncomplete(
"The user UTApiBlockee does not exist" );
61 if ( !array_key_exists(
'blocktoken',
$tokens ) ) {
62 $this->markTestIncomplete(
"No block token found" );
67 'user' =>
'UTApiBlockee',
68 'reason' =>
'Some reason',
69 'token' =>
$tokens[
'blocktoken'] ],
null,
false, self::$users[
'sysop']->getUser() );
73 $this->assertTrue( !is_null( $block ),
'Block is valid' );
75 $this->assertEquals(
'UTApiBlockee', (
string)$block->getTarget() );
76 $this->assertEquals(
'Some reason', $block->mReason );
77 $this->assertEquals(
'infinity', $block->mExpiry );
85 $user = User::newFromName(
'UTApiBlockee' );
87 if ( !$user->getId() ) {
88 $this->markTestIncomplete(
"The user UTApiBlockee does not exist." );
91 if ( !array_key_exists(
'blocktoken',
$tokens ) ) {
92 $this->markTestIncomplete(
"No block token found" );
97 'userid' => $user->getId(),
98 'reason' =>
'Some reason',
99 'token' =>
$tokens[
'blocktoken'] ],
null,
false, self::$users[
'sysop']->getUser() );
103 $this->assertTrue( !is_null( $block ),
'Block is valid.' );
104 $this->assertEquals(
'UTApiBlockee', (
string)$block->getTarget() );
105 $this->assertEquals(
'Some reason', $block->mReason );
106 $this->assertEquals(
'infinity', $block->mExpiry );
117 'user' =>
'UTApiBlockee',
118 'reason' =>
'Some reason',
122 self::$users[
'sysop']->getUser()
testMakeNormalBlockId()
Block by user ID.
testBlockingActionWithNoToken()
ApiUsageException The "token" parameter must be set.
testMakeNormalBlock()
This test has probably always been broken and use an invalid token Bug tracking brokenness is https:/...
doLogin( $testUser='sysop')
getTokenList(TestUser $user, $session=null)
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null)
Does the API request and returns the result.
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
static setPasswordForUser(User $user, $password)
Set the password on a testing user.