Remove unused stuff from tests
authoraddshore <addshorewiki@gmail.com>
Sat, 25 Jan 2014 13:26:03 +0000 (14:26 +0100)
committerAddshore <addshorewiki@gmail.com>
Fri, 7 Mar 2014 21:16:32 +0000 (21:16 +0000)
Change-Id: Iddabfbc80378b02fa4a2c58f80d50241be8105d3

tests/phpunit/includes/RevisionStorageTest.php
tests/phpunit/includes/WikiPageTest.php
tests/phpunit/includes/XmlTest.php
tests/phpunit/includes/api/ApiEditPageTest.php
tests/phpunit/includes/libs/RunningStatTest.php
tests/phpunit/includes/objectcache/BagOStuffTest.php
tests/phpunit/includes/upload/UploadFromUrlTest.php
tests/phpunit/includes/utils/UIDGeneratorTest.php

index f69fad4..e69660e 100644 (file)
@@ -206,10 +206,12 @@ class RevisionStorageTest extends MediaWikiTestCase {
         */
        public function testFetchRevision() {
                $page = $this->createPage( 'RevisionStorageTest_testFetchRevision', 'one', CONTENT_MODEL_WIKITEXT );
-               $id1 = $page->getRevision()->getId();
+
+               // Hidden process cache assertion below
+               $page->getRevision()->getId();
 
                $page->doEditContent( new WikitextContent( 'two' ), 'second rev' );
-               $id2 = $page->getRevision()->getId();
+               $id = $page->getRevision()->getId();
 
                $res = Revision::fetchRevision( $page->getTitle() );
 
@@ -219,9 +221,8 @@ class RevisionStorageTest extends MediaWikiTestCase {
                        $rows[$row->rev_id] = $row;
                }
 
-               $row = $res->fetchObject();
                $this->assertEquals( 1, count( $rows ), 'expected exactly one revision' );
-               $this->assertArrayHasKey( $id2, $rows, 'missing revision with id ' . $id2 );
+               $this->assertArrayHasKey( $id, $rows, 'missing revision with id ' . $id );
        }
 
        /**
index 6cf658f..9b41a9c 100644 (file)
@@ -593,8 +593,6 @@ class WikiPageTest extends MediaWikiLangTestCase {
                }
 
                $page = $this->createPage( $title, $text, $model );
-               $hasLinks = wfGetDB( DB_SLAVE )->selectField( 'pagelinks', 1,
-                       array( 'pl_from' => $page->getId() ), __METHOD__ );
 
                $editInfo = $page->prepareContentForEdit( $page->getContent() );
 
index 8205029..86b4c35 100644 (file)
@@ -144,10 +144,7 @@ class XmlTest extends MediaWikiTestCase {
                $prevYear = $curYear - 1;
 
                $curMonth = intval( gmdate( 'n' ) );
-               $prevMonth = $curMonth - 1;
-               if ( $prevMonth == 0 ) {
-                       $prevMonth = 12;
-               }
+
                $nextMonth = $curMonth + 1;
                if ( $nextMonth == 13 ) {
                        $nextMonth = 1;
index 0a6607e..80c2fde 100644 (file)
@@ -391,7 +391,6 @@ class ApiEditPageTest extends ApiTestCase {
                $rpage->doEditContent( new WikitextContent( "#REDIRECT [[$name]]" ),
                        "testing 1", EDIT_NEW, false, self::$users['sysop']->user );
                $this->forceRevisionDate( $rpage, '20120101000000' );
-               $baseTime = $rpage->getRevision()->getTimestamp();
 
                // new edit to content
                $page->doEditContent( new WikitextContent( "Foo bar" ),
index e24c088..dc5db82 100644 (file)
@@ -32,8 +32,6 @@ class RunningStatTest extends MediaWikiTestCase {
                        return pow( $mean - $x, 2 );
                }, $this->points ) ) / ( count( $rstat ) - 1 );
                $stddev = sqrt( $variance );
-               $min = min( $this->points );
-               $max = max( $this->points );
 
                $this->assertEquals( count( $rstat ), count( $this->points ) );
                $this->assertEquals( $rstat->min, min( $this->points ) );
index aa78394..1670823 100644 (file)
@@ -74,8 +74,6 @@ class BagOStuffTest extends MediaWikiTestCase {
                $fork &= !$this->cache instanceof MultiWriteBagOStuff;
                if ( $fork ) {
                        // callback should take awhile now so that we can test concurrent merge attempts
-                       $usleep = 5000;
-
                        $pid = pcntl_fork();
                        if ( $pid == -1 ) {
                                // can't fork, ignore this test...
index 397c100..879d821 100644 (file)
@@ -224,9 +224,6 @@ class UploadFromUrlTest extends ApiTestCase {
 
                $this->deleteFile( 'UploadFromUrlTest.png' );
 
-               $talkRev = Revision::newFromTitle( $talk );
-               $talkSize = $talkRev->getSize();
-
                $exception = false;
                try {
                        $this->doApiRequest( array(
@@ -249,6 +246,9 @@ class UploadFromUrlTest extends ApiTestCase {
                return;
                /*
                // Broken until using leavemessage with ignorewarnings is supported
+               $talkRev = Revision::newFromTitle( $talk );
+               $talkSize = $talkRev->getSize();
+
                $job->run();
 
                $this->assertFalse( wfLocalFile( 'UploadFromUrlTest.png' )->exists() );
index 1a1bbaf..1eab5a3 100644 (file)
@@ -21,9 +21,6 @@ class UIDGeneratorTest extends MediaWikiTestCase {
                }
 
                $lastId = array_shift( $ids );
-               if ( $hostbits ) {
-                       $lastHost = substr( wfBaseConvert( $lastId, 10, 2, $bits ), -$hostbits );
-               }
 
                $this->assertArrayEquals( array_unique( $ids ), $ids, "All generated IDs are unique." );