21 'title' =>
'Help:UTPage',
23 'token' =>
$tokens[
'edittoken'],
24 'watchlist' =>
'watch' ] );
25 $this->assertArrayHasKey(
'edit', $data[0] );
26 $this->assertArrayHasKey(
'result', $data[0][
'edit'] );
27 $this->assertEquals(
'Success', $data[0][
'edit'][
'result'] );
41 'list' =>
'watchlist' ] );
43 if ( isset( $data[0][
'query'][
'watchlist'] ) ) {
44 $wl = $data[0][
'query'][
'watchlist'];
46 foreach ( $wl as $page ) {
49 'title' => $page[
'title'],
51 'token' =>
$tokens[
'watchtoken'] ] );
56 'list' =>
'watchlist' ], $data );
57 $this->assertArrayHasKey(
'query', $data[0] );
58 $this->assertArrayHasKey(
'watchlist', $data[0][
'query'] );
59 foreach ( $data[0][
'query'][
'watchlist'] as $index => $item ) {
63 if ( strpos( $item[
'title'],
':' ) === 0 ) {
64 unset( $data[0][
'query'][
'watchlist'][$index] );
67 $this->assertEquals( 0, count( $data[0][
'query'][
'watchlist'] ) );
76 'action' =>
'protect',
77 'token' =>
$tokens[
'protecttoken'],
78 'title' =>
'Help:UTPage',
79 'protections' =>
'edit=sysop',
80 'watchlist' =>
'unwatch' ] );
82 $this->assertArrayHasKey(
'protect', $data[0] );
83 $this->assertArrayHasKey(
'protections', $data[0][
'protect'] );
84 $this->assertEquals( 1, count( $data[0][
'protect'][
'protections'] ) );
85 $this->assertArrayHasKey(
'edit', $data[0][
'protect'][
'protections'][0] );
91 if ( !Title::newFromText(
'Help:UTPage' )->exists() ) {
92 $this->markTestSkipped(
"The article [[Help:UTPage]] does not exist" );
97 'prop' =>
'revisions',
98 'titles' =>
'Help:UTPage',
99 'rvtoken' =>
'rollback' ] );
101 $this->assertArrayHasKey(
'query', $data[0] );
102 $this->assertArrayHasKey(
'pages', $data[0][
'query'] );
103 $keys = array_keys( $data[0][
'query'][
'pages'] );
104 $key = array_pop(
$keys );
106 if ( isset( $data[0][
'query'][
'pages'][$key][
'missing'] ) ) {
107 $this->markTestSkipped(
"Target page (Help:UTPage) doesn't exist" );
110 $this->assertArrayHasKey(
'pageid', $data[0][
'query'][
'pages'][$key] );
111 $this->assertArrayHasKey(
'revisions', $data[0][
'query'][
'pages'][$key] );
112 $this->assertArrayHasKey( 0, $data[0][
'query'][
'pages'][$key][
'revisions'] );
113 $this->assertArrayHasKey(
'rollbacktoken', $data[0][
'query'][
'pages'][$key][
'revisions'][0] );
125 $keys = array_keys( $data[0][
'query'][
'pages'] );
126 $key = array_pop(
$keys );
127 $pageinfo = $data[0][
'query'][
'pages'][$key];
128 $revinfo = $pageinfo[
'revisions'][0];
132 'action' =>
'rollback',
133 'title' =>
'Help:UTPage',
134 'user' => $revinfo[
'user'],
135 'token' => $pageinfo[
'rollbacktoken'],
136 'watchlist' =>
'watch' ] );
138 $this->assertArrayHasKey(
'rollback', $data[0] );
139 $this->assertArrayHasKey(
'title', $data[0][
'rollback'] );
141 if ( self::apiExceptionHasCode( $ue,
'onlyauthor' ) ) {
142 $this->markTestIncomplete(
"Only one author to 'Help:UTPage', cannot test rollback" );
144 $this->fail(
"Received error '" . $ue->getMessage() .
"'" );
getTokenList(TestUser $user, $session=null)
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
Does the API request and returns the result.
Exception used to abort API execution with an error.
testWatchRollback( $data)
Broken Broken because there is currently no revision info in the $pageinfo.
testWatchClear()
@depends testWatchEdit