/** * Internal routine for parsing the action name from the arguments * * @return null */ protected function _parseActionPart() { // the next "word" should be the action name $consoleActionName = array_shift($this->_argumentsWorking); if ($consoleActionName == '?') { $this->_help = true; return; } $actionSearchCriteria = array('type' => 'Tool', 'name' => 'actionName', 'value' => $consoleActionName, 'clientName' => 'console'); // is the action name valid? $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria); // check for normalized names as well (all lower, no separators) if (!$actionMetadata) { $actionSearchCriteria['name'] = 'normalizedActionName'; $actionSearchCriteria['value'] = strtolower(str_replace(array('-', '_'), '', $consoleActionName)); $actionSearchCriteria['clientName'] = 'all'; $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria); } // if no action, handle error if (!$actionMetadata) { require_once 'Zend/Tool/Framework/Client/Exception.php'; throw new Zend_Tool_Framework_Client_Exception('Action \'' . $consoleActionName . '\' is not a valid action.'); } // prepare action request name $this->_helpKnownAction = true; $this->_request->setActionName($actionMetadata->getActionName()); return; }
/** * Internal routine for parsing the action name from the arguments * * @return null */ protected function _parseActionPart() { // the next "word" should be the action name $consoleActionName = array_shift($this->_argumentsWorking); if ($consoleActionName == '?') { $this->_help = true; return; } // is the action name valid? $actionMetadata = $this->_manifestRepository->getMetadata(array('type' => 'Tool', 'name' => 'actionName', 'value' => $consoleActionName, 'clientName' => 'console')); // if no action, handle error if (!$actionMetadata) { // require_once 'Zend/Tool/Framework/Client/Exception.php'; throw new Zend_Tool_Framework_Client_Exception('Action \'' . $consoleActionName . '\' is not a valid action.'); } // prepare action request name $this->_helpKnownAction = true; $this->_request->setActionName($actionMetadata->getActionName()); return; }
public function testActionNameGetterAndSetter() { $this->_request->setActionName('foo'); $this->assertEquals('foo', $this->_request->getActionName()); }