/** * @covers ilRoomSharingFloorPlans::getFloorPlanInfo */ public function testGetFloorPlanInfo() { $floorPlanInfo = array('bla' => 'blu'); self::$DBMock->method("getFloorplan")->willReturn($floorPlanInfo); $info = self::$floorPlans->getFloorPlanInfo(234); self::$DBMock->expects($this->once())->method('getFloorplan')->with($this->equalTo(234)); self::assertEquals(1, count($info)); self::assertArrayHasKey('bla', $info); self::assertContains('blu', $info); }
/** * Create a form for editing existing floor plans. * * @param integer $a_file_id the id for the file which should be edited * * @return ilPropertyFormGUI the edit form */ protected function initEditForm($a_file_id) { $edit_form = new ilPropertyFormGUI(); $edit_form->setTitle($this->lng->txt("rep_robj_xrs_floor_plans_edit")); $title = $this->createTitleInputFormItem(); $edit_form->addItem($title); $desc = $this->createDescInputFormItem(); $edit_form->addItem($desc); $item = new ilHiddenInputGUI('file_id'); $item->setValue($a_file_id); $edit_form->addItem($item); $radg = $this->createRadioGroupInputFormItem(); $edit_form->addItem($radg); // look for floor plan infos and set the input entries accordingly $fplan = new ilRoomSharingFloorPlans($this->pool_id, new ilRoomsharingDatabase($this->pool_id)); $fplaninfo = $fplan->getFloorPlanInfo($a_file_id); if ($fplaninfo) { $mobj = new ilObjMediaObject($fplaninfo[0]["file_id"]); $title->setValue($mobj->getTitle()); $desc->setValue($mobj->getMediaItem("Standard")->getCaption()); } $edit_form->addCommandButton("update", $this->lng->txt("save")); $edit_form->addCommandButton("render", $this->lng->txt("cancel")); return $edit_form; }