private function assembleBimModelFromCurrentDatabaseRecord() { $bimModel = new BimModel(); $bimModel->setDatabaseId($this->db->f('id')); $bimModel->setName($this->db->f('name')); $bimModel->setCreationDate($this->db->f('created')); $bimModel->setFileSize($this->db->f('filesize')); $bimModel->setFileName($this->db->f('filename')); $bimModel->setUsedItemCount($this->db->f('used_item_count')); $bimModel->setVfsFileId($this->db->f('vfs_file_id')); return $bimModel; }
public function testRemoveBimModelByIdFromDatabase() { $this->createDummyVfsFile(); $sobimmodel = new sobimmodel_impl($this->db); $this->addBimModel($sobimmodel); $bimModelArray = $sobimmodel->retrieveBimModelList(); $modelFound = false; /* @var $bimModel BimModel */ foreach ($bimModelArray as $bimModel) { if ($bimModel->getFileName() == $this->vfsFileName && $bimModel->getVfsFileId() == $this->vfsFileId) { $modelFound = true; break; } } if ($modelFound) { $modelId = $bimModel->getDatabaseId(); $sobimmodel->setModelId($modelId); /* @var $retrievedBimModel BimModel */ $retrievedBimModel = $sobimmodel->retrieveBimModelInformationById(); $retrievedBimModel->setFileSize(null); $retrievedBimModel->setUsedItemCount(null); $retrievedBimModel->setCreationDate(null); $expectedBimModel = new BimModel(); $expectedBimModel->setDatabaseId($modelId); $expectedBimModel->setName($this->modelName); $expectedBimModel->setVfsFileId($this->vfsFileId); $expectedBimModel->setFileName($this->vfsFileName); $this->assertEquals($expectedBimModel, $retrievedBimModel); $sobimmodel->removeBimModelByIdFromDatabase(); $sobimmodel->setModelName($this->modelName); $sobimmodel->setVfsdatabaseid($this->vfsFileId); $this->assertTrue(!$sobimmodel->checkIfModelExists()); } else { $sobimmodel->removeBimModelFromDatabase(); $this->removeDummyVfsFile(); $this->fail("Model not found"); } $this->removeDummyVfsFile(); }