function perform() { if (!is_a($this->service_node, 'ContentServiceNode')) { return LIMB_STATUS_ERROR; } $content =& $this->service_node->getContentPart(); $map_content_command = new MapDataspaceToObjectCommand($this->content_map, $content); $map_content_command->perform(); $map_service_node_command = new MapDataspaceToServiceNodeCommand($this->service_node); $map_service_node_command->perform(); return LIMB_STATUS_OK; }
function testPerformOkAndSwitchPath() { $toolkit =& Limb::toolkit(); $dataspace =& $toolkit->getDataspace(); $dataspace->set('path', $path = 'Some path'); // will change parent_node_id $dataspace->set('parent_node_id', 100); // will be changed $dataspace->set('service_name', $service_name = 'some service name'); $dataspace->set('title', $title = 'some title'); $dataspace->set('identifier', $identifier = 'some identifier'); $this->tree->expectOnce('getNodeByPath', array($path)); $this->tree->setReturnValue('getNodeByPath', $node = array('id' => $new_parent_node_id = 101)); $service_node = new ServiceNode(); $command = new MapDataspaceToServiceNodeCommand($service_node); $this->assertEqual($command->perform(), LIMB_STATUS_OK); $node =& $service_node->getNodePart(); $this->assertEqual($node->get('parent_id'), $new_parent_node_id); $this->assertEqual($node->get('identifier'), $identifier); $service =& $service_node->getServicePart(); $this->assertEqual($service->get('name'), $service_name); $this->assertEqual($service->get('title'), $title); }
function performMapDataspaceToEntity() { include_once LIMB_SERVICE_NODE_DIR . '/commands/MapDataspaceToServiceNodeCommand.class.php'; $command = new MapDataspaceToServiceNodeCommand($this->entity); return $command->perform(); }