function testCreateNewAuthoritativePlantExtra() { $n = Authoritative_Plant_Extra::createNewAuthoritativePlantExtraFor('common name', 5001, $this->DB); $this->assertEqual('NEW', $n->authoritative_plant_extra_id); $this->assertNotEqual('', $n->created_at); $this->assertNotEqual('', $n->updated_at); $this->assertEqual(5001, $n->authoritative_plant_id); $this->assertEqual('common name', $n->type); $this->assertEqual('', $n->value); $this->assertEqual(0, $n->ordering); $this->assertEqual(false, $n->flag_active); $this->assertEqual(false, $n->flag_delete); }
// images can only be added and removed - not edited/modified $req_ape_value = trim($_REQUEST['authoritative_plant_extra_' . $db_ape->authoritative_plant_extra_id . '-value']); if ($db_ape->value != $req_ape_value) { $db_ape->value = $req_ape_value; $db_ape->updateDb(); } } } // new ones $created_authoritative_plant_extra_ids = explode(',', $_REQUEST['created_authoritative_plant_extra_ids']); foreach ($created_authoritative_plant_extra_ids as $created_authoritative_plant_extra_id) { if ($created_authoritative_plant_extra_id) { // echo "handling auth plant extra creation for $created_authoritative_plant_extra_id<br/>\n"; // util_prePrintR($_REQUEST); $new_ape_type = 'authoritative_plant_extra_' . $created_authoritative_plant_extra_id . '-type'; $new_ape = Authoritative_Plant_Extra::createNewAuthoritativePlantExtraFor($new_ape_type, $ap->authoritative_plant_id, $DB); $new_ape->notebook_page_field_id = $created_authoritative_plant_extra_id; $new_ape->setFromArray($_REQUEST); if ($new_ape->value != false) { $new_ape->authoritative_plant_extra_id = 'NEW'; $new_ape->updateDb(); } } } ///////////////////// // third, any specimens // deleted $deleted_specimen_ids = explode(',', $_REQUEST['deleted_specimen_ids']); if ($deleted_specimen_ids) { foreach ($deleted_specimen_ids as $deleted_specimen_id) { if ($deleted_specimen_id) {