/**
  * @covers ilRoomSharingFloorPlans::deleteFloorPlan
  */
 public function testDeleteFloorPlan()
 {
     define('DEBUG', 0);
     define('MAXLENGTH_OBJ_TITLE', 100);
     define('MAXLENGTH_OBJ_DESC', 100);
     define('MDB2_AUTOQUERY_INSERT', 'ins');
     global $ilias, $ilBench, $ilDB, $objDefinition, $ilObjDataCache;
     $ilias = self::getMockBuilder('ilias')->disableOriginalConstructor()->getMock();
     $ilBench = self::getMockBuilder('ilBenchmark')->disableOriginalConstructor()->getMock();
     $ilDB = self::getMockBuilder('ilDB')->disableOriginalConstructor()->getMock();
     $objDefinition = new ilObjectDefinition();
     $ilObjDataCache = self::getMockBuilder('ilObjectDataCache')->disableOriginalConstructor()->getMock();
     $ilObjDataCache->method("lookupType")->willReturn('xxx');
     $objData = array('obj_id' => 235, 'type' => 'xxx', 'title' => 'Red floorplan', 'description' => 'Newest plan', 'owner' => 1, 'create_date' => '2015', 'last_update' => '2015', 'import_id' => 0);
     $objUsages = array("mep_id" => "a");
     $ilDB->method("numRows")->willReturn(1);
     $ilDB->method("fetchAssoc")->will(self::onConsecutiveCalls($objData, false, false, $objUsages));
     self::$DBMock->method("deleteFloorPlan")->willReturn(1);
     self::$floorPlans->deleteFloorPlan(235);
     self::$DBMock->expects($this->once())->method('deleteFloorPlan')->with($this->equalTo(235));
     self::$DBMock->expects($this->once())->method('deleteFloorplanRoomAssociation')->with($this->equalTo(235));
 }
 /**
  * If the deletion is confirmed, this function is called.
  */
 public function removeFloorplanObject()
 {
     if (!$this->permission->checkPrivilege(PRIVC::DELETE_FLOORPLANS)) {
         ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action"));
         $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary');
         return false;
     }
     $fplan = $fplan = new ilRoomSharingFloorPlans($this->pool_id, new ilRoomsharingDatabase($this->pool_id));
     $result = $fplan->deleteFloorPlan((int) $_POST['file_id']);
     if ($result) {
         ilUtil::sendSuccess($this->lng->txt("rep_robj_xrs_floor_plans_deleted"), true);
     } else {
         ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_floor_plans_deleted_error"), true);
     }
     $this->renderObject();
 }