Set 'watchcreations' and 'watchdefault' options to true
authorBartosz Dziewoński <matma.rex@gmail.com>
Sun, 13 Oct 2013 20:51:55 +0000 (22:51 +0200)
committerOri.livneh <ori@wikimedia.org>
Sat, 7 Dec 2013 23:02:21 +0000 (23:02 +0000)
Also modify unit tests to be more resilient to various
other tests automatically having their pages being
watched.

Co-authored-by: Bartosz Dziewoński <matma.rex@gmail.com>
Co-authored-by: Brian Wolff <bawolff+wn@gmail.com>
Bug: 45020
Change-Id: I458783f02813ff023b2d142b57b44e5ec3ba30b9

RELEASE-NOTES-1.23
includes/DefaultSettings.php
tests/phpunit/includes/api/ApiWatchTest.php

index 6703f89..a498046 100644 (file)
@@ -21,6 +21,9 @@ production.
 * $wgSquidServersNoPurge now supports the use of Classless Inter-Domain
   Routing (CIDR) notation to specify contiguous blocks of IPv4 and/or IPv6
   addresses that should be trusted to provide X-Forwarded-For headers.
+* Preferences 'watchcreations' and 'watchdefault' ("Add pages I create and files
+  I upload to my watchlist", "Add pages and files I edit to my watchlist") are
+  now enabled by default.
 
 === New features in 1.23 ===
 * ResourceLoader can utilize the Web Storage API to cache modules client-side.
index 868c64e..5163e80 100644 (file)
@@ -4034,8 +4034,8 @@ $wgDefaultUserOptions = array(
        'uselivepreview' => 0,
        'usenewrc' => 0,
        'vector-simplesearch' => 1,
-       'watchcreations' => 0,
-       'watchdefault' => 0,
+       'watchcreations' => 1,
+       'watchdefault' => 1,
        'watchdeletion' => 0,
        'watchlistdays' => 3.0,
        'watchlisthideanons' => 0,
index 028ea9f..87f5190 100644 (file)
@@ -42,6 +42,7 @@ class ApiWatchTest extends ApiTestCase {
 
                $data = $this->doApiRequest( array(
                        'action' => 'query',
+                       'wllimit' => 'max',
                        'list' => 'watchlist' ) );
 
                if ( isset( $data[0]['query']['watchlist'] ) ) {
@@ -60,6 +61,14 @@ class ApiWatchTest extends ApiTestCase {
                        'list' => 'watchlist' ), $data );
                $this->assertArrayHasKey( 'query', $data[0] );
                $this->assertArrayHasKey( 'watchlist', $data[0]['query'] );
+               foreach( $data[0]['query']['watchlist'] as $index => $item ) {
+                       // Previous tests may insert an invalid title
+                       // like ":ApiEditPageTest testNonTextEdit", which
+                       // can't be cleared.
+                       if ( strpos( $item['title'] , ':' ) === 0 ) {
+                               unset( $data[0]['query']['watchlist'][$index] );
+                       }
+               }
                $this->assertEquals( 0, count( $data[0]['query']['watchlist'] ) );
 
                return $data;