$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);
$mShutDownSeleniumServer->subtype = Method::determineSubtypeByName($mShutDownSeleniumServer->name);
$mShutDownSeleniumServer->description = <<<TEXT
    Kills the running Selenium Server and all browser sessions. After you run this command, you will no longer be able
    to send commands to the server; you can't remotely start the server once it has been stopped.
    Normally you should prefer to run the "stop" command, which terminates the current browser session,
    rather than shutting down the entire server.
TEXT;
// return value
$mShutDownSeleniumServer->returnValue = ReturnValue::createNew();
$mShutDownSeleniumServer->returnValue->type = ReturnValue::TYPE_VOID;
// add to common method list (method and its derivative methods)
$methods[] = $mShutDownSeleniumServer;
// .... other methods place here. Should be added:
示例#2
0
 private function _createDerivativeMethodFromXML(\SimpleXMLElement $li)
 {
     $text = $li->asXML();
     preg_match('/(?P<name>[a-zA-Z]+)\\s*\\((?P<args>[a-zA-Z0-9\\,\\s\\<\\>\\/\\"\\#\\=]+)\\)/', $text, $m) && array_key_exists('name', $m) && array_key_exists('args', $m) or die('Error at parse derivative method: ' . $text);
     // Name
     $method = Method::createNew();
     $method->name = $m['name'];
     // Arguments
     if ($args = trim($m['args'])) {
         foreach (explode(',', $args) as $arg) {
             $argument = Argument::createNew()->setMethod($method);
             $argument->name = trim(strip_tags($arg));
             $method->addArgument($argument);
         }
     }
     return $method;
 }
 */
// HTML documentation (local file can be changed to http://release.seleniumhq.org/selenium-core/1.0.1/reference.html)
define('SELENIUM_DOC_REFERENCE', 'source-doc/selenium-core-reference-1.0.1.html');
// Load manual description of some methods
$manualMethodsDescription = (require_once 'source-doc/manual_methods_description.php');
// Parsing of official documentation
$parser = new Parser(file_get_contents(SELENIUM_DOC_REFERENCE));
// Search description for available selenium commands (methods of phpunit-selenium-driver)
$driver = new phpunitSeleniumDriver();
$generator = new CodeGenerator();
$seleniumCommands = $driver->getAvailableSeleniumCommands();
$methodsByBaseName = [];
$notFounded = [];
foreach ($seleniumCommands as $methodFullName => $returnType) {
    // Create model of available method
    $method = models\Method::createNew();
    $method->name = $methodFullName;
    $method->type = models\Method::determineTypeByName($methodFullName);
    $method->subtype = models\Method::determineSubtypeByName($methodFullName);
    $method->returnValue = models\ReturnValue::createNew();
    $method->returnValue->type = $returnType;
    // Search of description in manual/parsed docs
    $documentedMethod = null;
    if (array_key_exists($methodFullName, $manualMethodsDescription)) {
        $documentedMethod = $manualMethodsDescription[$methodFullName];
    } elseif ($foundMethod = $parser->getMethodByBaseName($method->getBaseName(true))) {
        $documentedMethod = $generator->createNewMethodWithName($foundMethod, $method->name);
        // convert to target method
        $documentedMethod->returnValue->type = $returnType;
        // selenium documentation has no info about php variable type
    }