24 'title' =>
'Help:UTPage',
26 'token' =>
$tokens[
'edittoken'],
27 'watchlist' =>
'watch' ] );
28 $this->assertArrayHasKey(
'edit', $data[0] );
29 $this->assertArrayHasKey(
'result', $data[0][
'edit'] );
30 $this->assertEquals(
'Success', $data[0][
'edit'][
'result'] );
44 'list' =>
'watchlist' ] );
46 if ( isset( $data[0][
'query'][
'watchlist'] ) ) {
47 $wl = $data[0][
'query'][
'watchlist'];
49 foreach ( $wl
as $page ) {
52 'title' => $page[
'title'],
54 'token' =>
$tokens[
'watchtoken'] ] );
59 'list' =>
'watchlist' ], $data );
60 $this->assertArrayHasKey(
'query', $data[0] );
61 $this->assertArrayHasKey(
'watchlist', $data[0][
'query'] );
62 foreach ( $data[0][
'query'][
'watchlist']
as $index => $item ) {
66 if ( strpos( $item[
'title'],
':' ) === 0 ) {
67 unset( $data[0][
'query'][
'watchlist'][$index] );
70 $this->assertEquals( 0,
count( $data[0][
'query'][
'watchlist'] ) );
79 'action' =>
'protect',
80 'token' =>
$tokens[
'protecttoken'],
81 'title' =>
'Help:UTPage',
82 'protections' =>
'edit=sysop',
83 'watchlist' =>
'unwatch' ] );
85 $this->assertArrayHasKey(
'protect', $data[0] );
86 $this->assertArrayHasKey(
'protections', $data[0][
'protect'] );
87 $this->assertEquals( 1,
count( $data[0][
'protect'][
'protections'] ) );
88 $this->assertArrayHasKey(
'edit', $data[0][
'protect'][
'protections'][0] );
95 $this->markTestSkipped(
"The article [[Help:UTPage]] does not exist" );
100 'prop' =>
'revisions',
101 'titles' =>
'Help:UTPage',
102 'rvtoken' =>
'rollback' ] );
104 $this->assertArrayHasKey(
'query', $data[0] );
105 $this->assertArrayHasKey(
'pages', $data[0][
'query'] );
106 $keys = array_keys( $data[0][
'query'][
'pages'] );
107 $key = array_pop(
$keys );
109 if ( isset( $data[0][
'query'][
'pages'][$key][
'missing'] ) ) {
110 $this->markTestSkipped(
"Target page (Help:UTPage) doesn't exist" );
113 $this->assertArrayHasKey(
'pageid', $data[0][
'query'][
'pages'][$key] );
114 $this->assertArrayHasKey(
'revisions', $data[0][
'query'][
'pages'][$key] );
115 $this->assertArrayHasKey( 0, $data[0][
'query'][
'pages'][$key][
'revisions'] );
116 $this->assertArrayHasKey(
'rollbacktoken', $data[0][
'query'][
'pages'][$key][
'revisions'][0] );
128 $keys = array_keys( $data[0][
'query'][
'pages'] );
129 $key = array_pop(
$keys );
130 $pageinfo = $data[0][
'query'][
'pages'][$key];
131 $revinfo = $pageinfo[
'revisions'][0];
135 'action' =>
'rollback',
136 'title' =>
'Help:UTPage',
137 'user' => $revinfo[
'user'],
138 'token' => $pageinfo[
'rollbacktoken'],
139 'watchlist' =>
'watch' ] );
141 $this->assertArrayHasKey(
'rollback', $data[0] );
142 $this->assertArrayHasKey(
'title', $data[0][
'rollback'] );
144 if ( self::apiExceptionHasCode( $ue,
'onlyauthor' ) ) {
145 $this->markTestIncomplete(
"Only one author to 'Help:UTPage', cannot test rollback" );
147 $this->fail(
"Received error '" . $ue->getMessage() .
"'" );