/** * This is what Datamanager calls to actually create a directory */ public function &dm2_create_callback(&$datamanager) { $topic = new org_openpsa_documents_directory(); $topic->up = $this->_request_data['directory']->id; $topic->component = 'org.openpsa.documents'; // Set the name by default $topic->name = midcom_helper_misc::generate_urlname_from_string($_POST['extra']); if (!$topic->create()) { debug_print_r('We operated on this object:', $topic); throw new midcom_error("Failed to create a new topic, cannot continue. Error: " . midcom_connection::get_error_string()); } $this->_request_data['directory'] = new org_openpsa_documents_directory($topic->id); return $topic; }
public function testCRUD() { $user = $this->create_user(true); midcom::get('auth')->request_sudo('org.openpsa.documents'); $directory = new org_openpsa_documents_directory(); $directory->name = 'TEST_' . __CLASS__ . time(); $stat = $directory->create(); $this->assertTrue($stat); $this->register_object($directory); $stat = $directory->update(); $this->assertTrue($stat); $stat = $directory->delete(); $this->assertTrue($stat); midcom::get('auth')->drop_sudo(); }