1 | <?php |
||
16 | class RestrictedEntityLookupTest extends \PHPUnit_Framework_TestCase { |
||
17 | |||
18 | /** |
||
19 | * @return EntityLookup |
||
20 | */ |
||
21 | private function getEntityLookup() { |
||
22 | $entityLookup = $this->getMock( 'Wikibase\DataModel\Services\Lookup\EntityLookup' ); |
||
23 | |||
24 | $entityLookup->expects( $this->any() ) |
||
25 | ->method( 'hasEntity' ) |
||
26 | ->will( $this->returnValue( true ) ); |
||
27 | |||
28 | $entityLookup->expects( $this->any() ) |
||
29 | ->method( 'getEntity' ) |
||
30 | ->will( $this->returnCallback( function( EntityId $id ) { |
||
31 | return $id->getSerialization(); |
||
32 | } ) ); |
||
33 | |||
34 | return $entityLookup; |
||
35 | } |
||
36 | |||
37 | public function testConstructor() { |
||
38 | $lookup = new RestrictedEntityLookup( $this->getEntityLookup(), 1 ); |
||
39 | $this->assertInstanceOf( |
||
40 | 'Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup', |
||
41 | $lookup |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @expectedException \InvalidArgumentException |
||
47 | */ |
||
48 | public function testConstructor_exception() { |
||
51 | |||
52 | public function testHasEntity() { |
||
53 | $lookup = new RestrictedEntityLookup( $this->getEntityLookup(), 200 ); |
||
57 | |||
58 | public function testGetEntityAccessCount() { |
||
69 | |||
70 | public function testReset() { |
||
83 | |||
84 | public function testGetEntity() { |
||
94 | |||
95 | public function testGetEntity_exception() { |
||
105 | |||
106 | public function testHasEntityBeenAccessed() { |
||
113 | |||
114 | } |
||
115 |