/**
  * @return EntityLookup
  */
 protected static function getEntityLookup()
 {
     $phpunit = new self();
     $entityLookup = $phpunit->getMock('Wikibase\\DataModel\\Services\\Lookup\\EntityLookup');
     $entityLookup->expects($phpunit->exactly(20))->method('getEntity')->will($phpunit->returnCallback(function (ItemId $id) {
         return new Item($id);
     }));
     return $entityLookup;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $test = new self();
     self::$DBMock = $test->getMockBuilder('ilRoomSharingDatabase')->disableOriginalConstructor()->getMock();
     global $lng;
     $lng = $test->getMock('lng', array('txt'), array(), '', false);
     $lng->method("txt")->willReturn("translation");
     // We assume that we have all privileges.
     global $rssPermission;
     $rssPermission = $test->getMockBuilder('ilRoomSharingPermissionUtils')->disableOriginalConstructor()->getMock();
     $rssPermission->method("checkPrivilege")->willReturn(true);
     $existingRoomNames = array('I012 A', 'I035', 'Dojo X', 'Pinguin');
     self::$DBMock->method("getAllRoomNames")->willReturn($existingRoomNames);
     $allRoomAttributes = array(array('id' => 1, 'name' => 'Beamer', 'pool_id' => 1), array('id' => 2, 'name' => 'Whiteboard', 'pool_id' => 1), array('id' => 3, 'name' => 'Tafelstifte', 'pool_id' => 1), array('id' => 4, 'name' => 'Fernseher', 'pool_id' => 1), array('id' => 5, 'name' => 'Desktop PCs', 'pool_id' => 1), array('id' => 6, 'name' => 'Schwämme', 'pool_id' => 1));
     self::$DBMock->method("getAllRoomAttributes")->willReturn($allRoomAttributes);
     $roomProperties = array('id' => 1, 'name' => 'I012 A', 'type' => 'Saal', 'min_alloc' => 20, 'max_alloc' => 100, 'file_id' => 450, 'building_id' => 230, 'pool_id' => 1);
     self::$DBMock->method("getRoom")->willReturn($roomProperties);
     $roomAttributes = array(array('id' => 1, 'name' => 'Beamer', 'count' => 3), array('id' => 4, 'name' => 'Fernseher', 'count' => 1), array('id' => 2, 'name' => 'Whiteboard', 'count' => 2));
     self::$DBMock->method("getAttributesForRoom")->willReturn($roomAttributes);
     $bookings = array(array('id' => 12, 'date_from' => '2014-12-09 15:00:00.000000', 'date_to' => '2014-12-09 18:00:00.000000', 'seq_id' => null, 'room_id' => 1, 'pool_id' => 1, 'user_id' => 3, 'subject' => 'Test', 'public_booking' => 0, 'bookingcomment' => 'Ist eine Testbuchung', 'calendar_entry_id' => 23));
     self::$DBMock->method("getAllBookingsForRoom")->willReturn($bookings);
     self::$room = new ilRoomSharingRoom(1, 1, false, self::$DBMock);
 }