return $fakeRow;
}
+ private function newWatchedItemStore( LoadBalancer $loadBalancer, HashBagOStuff $cache ) {
+ return new WatchedItemStore(
+ $loadBalancer,
+ $cache
+ );
+ }
+
public function testGetDefaultInstance() {
$instanceOne = WatchedItemStore::getDefaultInstance();
$instanceTwo = WatchedItemStore::getDefaultInstance();
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
)
->will( $this->returnValue( new FakeResultWrapper( [] ) ) );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$this->getMockCache()
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->method( 'delete' )
->with( '0:Some_Page:1' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )
->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->method( 'delete' )
->with( '1:Some_Page:1' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )
->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )
->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
'0:SomeDbKey:1'
);
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->method( 'delete' )
->with( '0:SomeDbKey:1' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->method( 'delete' )
->with( '0:SomeDbKey:1' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )
->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
'0:SomeDbKey:1'
);
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
)
->will( $this->returnValue( $cachedItem ) );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->with( '0:SomeDbKey:1' )
->will( $this->returnValue( false ) );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'set' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
)
->will( $this->returnValue( [] ) );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$mockLoadBalancer,
$mockCache
);
}
public function testGetWatchedItemsForUser_badSortOptionThrowsException() {
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $this->getMockDb() ),
$this->getMockCache()
);
'0:SomeDbKey:1'
);
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->with( '0:SomeDbKey:1' )
->will( $this->returnValue( false ) );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache = $this->getMockCache();
$mockCache->expects( $this->never() )->method( $this->anything() );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'set' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->method( 'delete' )
->with( '0:SomeDbKey:1' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockDb->expects( $this->never() )
->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockDb->expects( $this->never() )
->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockDb->expects( $this->never() )
->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
$mockCache->expects( $this->never() )->method( 'get' );
$mockCache->expects( $this->never() )->method( 'delete' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);
->method( 'delete' )
->with( '0:SomeDbKey:1' );
- $store = new WatchedItemStore(
+ $store = $this->newWatchedItemStore(
$this->getMockLoadBalancer( $mockDb ),
$mockCache
);