'basetimestamp' => $baseTime,
'section' => 'new',
'redirect' => true,
- ], null, self::$users['sysop']->getUser() );
+ ] );
$this->assertSame( 'Success', $re['edit']['result'],
"no problems expected when following redirect" );
'text' => 'nix bar!',
'basetimestamp' => $baseTime,
'redirect' => true,
- ], null, self::$users['sysop']->getUser() );
+ ] );
$this->fail( 'redirect-appendonly error expected' );
} catch ( ApiUsageException $ex ) {
'title' => $name,
'text' => 'nix bar!',
'basetimestamp' => $baseTime,
- ], null, self::$users['sysop']->getUser() );
+ ] );
$this->fail( 'edit conflict expected' );
} catch ( ApiUsageException $ex ) {
'text' => 'nix bar!',
'basetimestamp' => $baseTime,
'section' => 'new',
- ], null, self::$users['sysop']->getUser() );
+ ] );
$this->assertSame( 'Success', $re['edit']['result'],
"no edit conflict expected here" );
'text' => 'nix bar!',
'section' => 'new',
'redirect' => true,
- ], null, self::$users['sysop']->getUser() );
+ ] );
$this->assertSame( 'Success', $re['edit']['result'],
"no edit conflict expected here" );
$name = 'Help:' . __FUNCTION__;
$uploader = self::$users['uploader']->getUser();
$sysop = self::$users['sysop']->getUser();
+
$apiResult = $this->doApiRequestWithToken( [
'action' => 'edit',
'title' => $name,
public function testCreateImageRedirectAnon() {
$name = 'File:' . ucfirst( __FUNCTION__ );
- // @todo When ApiTestCase supports anonymous users, this exception
- // should no longer be thrown, and the test can then be updated to test
- // for the actual expected behavior.
$this->setExpectedException( ApiUsageException::class,
- 'Invalid CSRF token.' );
-
- $this->doApiRequestWithToken( [
- 'action' => 'logout',
- ] );
+ "Anonymous users can't create image redirects." );
$this->doApiRequestWithToken( [
'action' => 'edit',
'title' => $name,
'text' => '#REDIRECT [[File:Other file.png]]',
- ] );
+ ], null, new User() );
}
public function testCreateImageRedirectLoggedIn() {
public function testProhibitedAnonymousEdit() {
$name = 'Help:' . ucfirst( __FUNCTION__ );
- // @todo See comment in testCreateImageRedirectAnon
$this->setExpectedException( ApiUsageException::class,
- 'Invalid CSRF token.' );
- $this->setMwGlobals( 'wgRevokePermissions',
- [ '*' => [ 'edit' => true ] ] );
+ 'The action you have requested is limited to users in the group: ' );
- $this->doApiRequestWithToken( [
- 'action' => 'logout',
- ] );
+ $this->setMwGlobals( 'wgRevokePermissions', [ '*' => [ 'edit' => true ] ] );
$this->doApiRequestWithToken( [
'action' => 'edit',
'title' => $name,
'text' => 'Some text',
- ] );
+ ], null, new User() );
}
public function testProhibitedChangeContentModel() {