public function _itReconstitutesPermissions() { $xml = new SimpleXMLElement(' <condition type="perms"> <permissions> <permission ugroup="UGROUP_PROJECT_MEMBERS"/> <permission ugroup="UGROUP_PROJECT_ADMIN"/> </permissions> </condition> '); $condition = $this->permissions_factory->getInstanceFromXML($xml, $this->xml_mapping, $this->transition); $this->assertIsA($condition, 'Workflow_Transition_Condition_Permissions'); }
/** * Creates a transition Object * * @param SimpleXMLElement $xml containing the structure of the imported workflow * @param array &$xmlMapping containig the newly created formElements idexed by their XML IDs * * @return Workflow_Transition_Condition The condition object, or null if error */ private function getInstanceFromXML($xml, &$xmlMapping, Transition $transition) { $type = (string) $xml['type']; $condition = null; switch ($type) { case 'perms': if ($xml->permissions) { $condition = $this->permissions_factory->getInstanceFromXML($xml, $xmlMapping, $transition); } break; case 'notempty': $condition = $this->fieldnotempty_factory->getInstanceFromXML($xml, $xmlMapping, $transition); break; } return $condition; }