* @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' ] )
$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() {
$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() {
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 ) )
}
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 ] );
$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 () {
$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() )
$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(
[
$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(
[
$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(
[