public function test_delete() { $x = new Armor(); $x->characterId = $this->id; $allArmor = array(array('armor_name' => "first armor, +" . __LINE__, 'ac_bonus' => __LINE__), array('armor_name' => "second armor, +" . __LINE__, 'ac_bonus' => __LINE__)); $myIds = array(); foreach ($allArmor as $data) { $data['character_id'] = $this->id; $thisId = $x->create($this->dbObj, $data); $this->assertTrue(is_numeric($thisId)); $myIds[$thisId] = $data; } $numLeft = count($myIds); foreach ($myIds as $i => $insertData) { $x->id = $i; $testData = $x->load($this->dbObj); foreach ($insertData as $k => $v) { $this->assertEquals($v, $testData[$k]); } } }
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; }