public function test_update_and_delete() { $x = new SpecialAbility(); $x->characterId = $this->char->characterId; $id = $x->create($this->dbObj, array('character_id' => $x->characterId, 'special_ability_name' => __METHOD__)); $this->assertTrue(is_numeric($id)); $this->assertTrue($id > 0); $data = $x->load($this->dbObj); $this->assertTrue(is_array($data)); $this->assertTrue(count($data) > 0); $this->assertEquals(1, $x->delete($this->dbObj)); $this->assertEquals(array(), $x->load($this->dbObj)); }
public function handle_delete($type, $recordId) { $retval = "Invalid section... type=(" . $type . "), recordId=(" . $recordId . ")"; // $log = new cs_webdblogger($this->dbObj, "Character"); switch ($type) { case 'weapon': case Weapon::sheetIdPrefix: $x = new Weapon(); $x->load($this->dbObj, $recordId); $retval = $x->delete($this->dbObj); break; case 'armor': case Armor::sheetIdPrefix: $x = new Armor(); $x->load($this->dbObj, $recordId); $retval = $x->delete($this->dbObj); break; case 'skill': case Skill::sheetIdPrefix: $x = new Skill(); $x->load($this->dbObj, $recordId); $retval = $x->delete($this->dbObj); break; case 'feat': case 'specialAbility': case SpecialAbility::sheetIdPrefix: $x = new SpecialAbility(); $x->load($this->dbObj, $recordId); $retval = $x->delete($this->dbObj); break; case 'gear': case Gear::sheetIdPrefix: $x = new Gear(); $x->load($this->dbObj, $recordId); $retval = $x->delete($this->dbObj); break; } // $log->log_by_class("type=(". $type ."), recordId=(". $recordId ."), result::: ". $retval, "delete"); return $retval; }