function testPlayerObjectCanSaveDetails() { $bel = 'Believes in the mirror goddess.'; $traits = 'Weird,Blue'; $desc = 'Some description for testing'; $goals = 'Test: to rule the world'; $instincts = 'Kill Samurai'; $char = new Player($this->char_id); $char->set_traits($traits); $char->set_beliefs($bel); $char->set_description($desc); $char->set_goals($goals); $char->set_instincts($instincts); PlayerDAO::saveDetails($char); $char = new Player($this->char_id); // Create a new player copy. $this->assertEquals($desc, $char->description()); $this->assertEquals($traits, $char->traits()); $this->assertEquals($bel, $char->beliefs()); $this->assertEquals($goals, $char->goals()); $this->assertEquals($instincts, $char->instincts()); }
// Check that the text features don't differ $char->set_description($description); $char->set_goals($goals); $char->set_instincts($instincts); $char->set_beliefs($beliefs); $char->set_traits($traits); /* foreach(['description', 'goals', 'instincts', 'beliefs', 'traits'] as $type){ if($$type && isset($char->vo)){ $method = 'set_'.$type; $char->$method($$type); // Set the various details in the Player obj $changed = true; } $$type = $char->$type(); // Default to current values. }*/ $changed = PlayerDAO::saveDetails($char); redirect('/stats.php?changed=' . (int) $changed . ($profile_changed ? '&profile_changed=1' : '')); } /* if(false && DEBUG){ $description = 'This is a description here and all'; $goals = 'Kill ninja of the ramen clan'; $beliefs = 'I believe in a one true ninja god'; $instincts = 'When I hear whistling, I duck'; $traits = 'Hardy, nervous, meaty, silent'; } */ $player = self_info(); //$player['created_date']=$player['created_date']? date("c", strtotime($player['created_date'])) : null; $class_theme = class_theme($char->class_identity()); $level_category = level_category($player['level']);