Merge "Add config for serving main Page from the domain root"
[lhc/web/wiklou.git] / tests / phpunit / includes / watcheditem / WatchedItemStoreUnitTest.php
index 72db766..e40417c 100644 (file)
@@ -86,6 +86,10 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
         * @return PHPUnit_Framework_MockObject_MockObject|HashBagOStuff
         */
        private function getMockCache() {
+               if ( defined( 'HHVM_VERSION' ) ) {
+                       $this->markTestSkipped( 'HHVM Reflection buggy' );
+               }
+
                $mock = $this->getMockBuilder( HashBagOStuff::class )
                        ->disableOriginalConstructor()
                        ->setMethods( [ 'get', 'set', 'delete', 'makeKey' ] )
@@ -1176,7 +1180,7 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
                $this->assertInstanceOf( WatchedItem::class, $watchedItem );
                $this->assertEquals( 1, $watchedItem->getUser()->getId() );
                $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
-               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
+               $this->assertSame( 0, $watchedItem->getLinkTarget()->getNamespace() );
        }
 
        public function testLoadWatchedItem_noItem() {
@@ -1378,7 +1382,7 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
                $this->assertInstanceOf( WatchedItem::class, $watchedItem );
                $this->assertEquals( 1, $watchedItem->getUser()->getId() );
                $this->assertEquals( 'SomeDbKey', $watchedItem->getLinkTarget()->getDBkey() );
-               $this->assertEquals( 0, $watchedItem->getLinkTarget()->getNamespace() );
+               $this->assertSame( 0, $watchedItem->getLinkTarget()->getNamespace() );
        }
 
        public function testGetWatchedItem_cachedItem() {
@@ -1833,8 +1837,7 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
                        new WatchedItem( $user, $targets[0], '20151212010101' ),
                        new WatchedItem( $user, $targets[1], null ),
                ];
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )->method( $this->anything() );
+               $mockDb = $this->createNoOpMock( IDatabase::class );
 
                $mockCache = $this->getMockCache();
                $mockCache->expects( $this->at( 1 ) )
@@ -1860,16 +1863,18 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
        }
 
        public function testGetNotificationTimestampsBatch_anonymousUser() {
+               if ( defined( 'HHVM_VERSION' ) ) {
+                       $this->markTestSkipped( 'HHVM Reflection buggy' );
+               }
+
                $targets = [
                        new TitleValue( 0, 'SomeDbKey' ),
                        new TitleValue( 1, 'AnotherDbKey' ),
                ];
 
-               $mockDb = $this->getMockDb();
-               $mockDb->expects( $this->never() )->method( $this->anything() );
+               $mockDb = $this->createNoOpMock( IDatabase::class );
 
-               $mockCache = $this->getMockCache();
-               $mockCache->expects( $this->never() )->method( $this->anything() );
+               $mockCache = $this->createNoOpMock( HashBagOStuff::class );
 
                $store = $this->newWatchedItemStore( [ 'db' => $mockDb, 'cache' => $mockCache ] );
 
@@ -2082,8 +2087,7 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
 
                $mockQueueGroup = $this->getMockJobQueueGroup();
 
-               $mockRevisionRecord = $this->createMock( RevisionRecord::class );
-               $mockRevisionRecord->expects( $this->never() )->method( $this->anything() );
+               $mockRevisionRecord = $this->createNoOpMock( RevisionRecord::class );
 
                $mockRevisionLookup = $this->getMockRevisionLookup( [
                        'getTimestampFromId' => function () {
@@ -2140,11 +2144,8 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
                $oldid = 22;
                $title = new TitleValue( 0, 'SomeDbKey' );
 
-               $mockRevision = $this->createMock( RevisionRecord::class );
-               $mockRevision->expects( $this->never() )->method( $this->anything() );
-
-               $mockNextRevision = $this->createMock( RevisionRecord::class );
-               $mockNextRevision->expects( $this->never() )->method( $this->anything() );
+               $mockRevision = $this->createNoOpMock( RevisionRecord::class );
+               $mockNextRevision = $this->createNoOpMock( RevisionRecord::class );
 
                $mockDb = $this->getMockDb();
                $mockDb->expects( $this->once() )
@@ -2254,11 +2255,8 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
 
                $mockQueueGroup = $this->getMockJobQueueGroup();
 
-               $mockRevision = $this->createMock( RevisionRecord::class );
-               $mockRevision->expects( $this->never() )->method( $this->anything() );
-
-               $mockNextRevision = $this->createMock( RevisionRecord::class );
-               $mockNextRevision->expects( $this->never() )->method( $this->anything() );
+               $mockRevision = $this->createNoOpMock( RevisionRecord::class );
+               $mockNextRevision = $this->createNoOpMock( RevisionRecord::class );
 
                $mockRevisionLookup = $this->getMockRevisionLookup(
                        [
@@ -2346,11 +2344,8 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
 
                $mockQueueGroup = $this->getMockJobQueueGroup();
 
-               $mockRevision = $this->createMock( RevisionRecord::class );
-               $mockRevision->expects( $this->never() )->method( $this->anything() );
-
-               $mockNextRevision = $this->createMock( RevisionRecord::class );
-               $mockNextRevision->expects( $this->never() )->method( $this->anything() );
+               $mockRevision = $this->createNoOpMock( RevisionRecord::class );
+               $mockNextRevision = $this->createNoOpMock( RevisionRecord::class );
 
                $mockRevisionLookup = $this->getMockRevisionLookup(
                        [
@@ -2438,11 +2433,8 @@ class WatchedItemStoreUnitTest extends MediaWikiTestCase {
 
                $mockQueueGroup = $this->getMockJobQueueGroup();
 
-               $mockRevision = $this->createMock( RevisionRecord::class );
-               $mockRevision->expects( $this->never() )->method( $this->anything() );
-
-               $mockNextRevision = $this->createMock( RevisionRecord::class );
-               $mockNextRevision->expects( $this->never() )->method( $this->anything() );
+               $mockRevision = $this->createNoOpMock( RevisionRecord::class );
+               $mockNextRevision = $this->createNoOpMock( RevisionRecord::class );
 
                $mockRevisionLookup = $this->getMockRevisionLookup(
                        [