コード例 #1
0
 /**
  * Creates argument and load data from specified XML node.
  *
  * Typical html code that described argument of method:
  * <pre><code>
  *      <li>strategyName - the name of the strategy to define; this should use only letters [a-zA-Z] with no
  *      spaces or other punctuation.
  *      </li>
  *
  *      // OR
  *
  *      <li>functionDefinition - a string defining the body of a function in JavaScript. For example:
  *      < code >return inDocument.getElementById(locator);< / code >
  *      </li>
  * </code></pre>
  *
  * @param \SimpleXMLElement $li XML node, which contain list item with detail description of argument
  *
  * @return Argument
  */
 private function _createArgumentFromXML(\SimpleXMLElement $li)
 {
     $argument = Argument::createNew();
     $text = $li->asXML();
     preg_match('/<li>\\s*(?P<name>[a-zA-Z0-9]+)\\s*-\\s*(?P<description>[\\s\\S]+)\\s*<\\/li>/', $text, $matches) && array_key_exists('name', $matches) && array_key_exists('description', $matches) or die('Error at parse argument description: ' . $text);
     $argument->name = $matches['name'];
     $argument->description = $matches['description'];
     $argument->type = Argument::DEFAULT_TYPE;
     // by default we assume string variable type
     // todo need more accurate algorithm type determination (for example, by prefix of argument name ...)
     return $argument;
 }
コード例 #2
0
// return value
$mRetrieveLastRemoteControlLogs->returnValue = ReturnValue::createNew();
$mRetrieveLastRemoteControlLogs->returnValue->type = ReturnValue::TYPE_STRING;
$mRetrieveLastRemoteControlLogs->returnValue->description = 'The last N log messages as a multi-line string.';
// add to common method list (method and its derivative methods)
$methods[] = $mRetrieveLastRemoteControlLogs;
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// ---- setContext
$mSetContext = Method::createNew();
$mSetContext->name = 'setContext';
$mSetContext->type = Method::determineTypeByName($mSetContext->name);
$mSetContext->subtype = Method::determineSubtypeByName($mSetContext->name);
$mSetContext->description = 'Writes a message to the status bar and adds a note to the browser-side log.';
// first argument
$argument = Argument::createNew();
$argument->name = 'context';
$argument->type = Argument::DEFAULT_TYPE;
$argument->description = 'the message to be sent to the browser';
$mSetContext->addArgument($argument);
// return value
$mSetContext->returnValue = ReturnValue::createNew();
$mSetContext->returnValue->type = ReturnValue::TYPE_VOID;
// add to common method list (method and its derivative methods)
$methods[] = $mSetContext;
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// ---- shutDownSeleniumServer
$mShutDownSeleniumServer = Method::createNew();
$mShutDownSeleniumServer->name = 'shutDownSeleniumServer';
$mShutDownSeleniumServer->type = Method::determineTypeByName($mShutDownSeleniumServer->name);