Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractWebDriver.php

function AbstractWebDriver::__call

Magic method that maps calls to class methods to execute WebDriver commands

Parameters

string $name Method name:

array $arguments Arguments:

Return value

mixed

Throws

\WebDriver\Exception if invalid WebDriver command

2 calls to AbstractWebDriver::__call()
Container::__call in vendor/lullabot/php-webdriver/lib/WebDriver/Container.php
Magic method that maps calls to class methods to execute WebDriver commands
Container::__call in vendor/lullabot/php-webdriver/lib/WebDriver/Container.php
Magic method that maps calls to class methods to execute WebDriver commands
1 method overrides AbstractWebDriver::__call()
Container::__call in vendor/lullabot/php-webdriver/lib/WebDriver/Container.php
Magic method that maps calls to class methods to execute WebDriver commands

File

vendor/lullabot/php-webdriver/lib/WebDriver/AbstractWebDriver.php, line 255

Class

AbstractWebDriver
Abstract WebDriver\AbstractWebDriver class

Namespace

WebDriver

Code

public function __call($name, $arguments) {
    if (count($arguments) > 1) {
        throw WebDriverException::factory(WebDriverException::JSON_PARAMETERS_EXPECTED, 'Commands should have at most only one parameter, which should be the JSON Parameter object');
    }
    if (preg_match('/^(get|post|delete)/', $name, $matches)) {
        $requestMethod = strtoupper($matches[0]);
        $webdriverCommand = strtolower(substr($name, strlen($requestMethod)));
        $this->getRequestMethod($webdriverCommand);
        // validation
    }
    else {
        $webdriverCommand = $name;
        $requestMethod = $this->getRequestMethod($webdriverCommand);
    }
    $methods = $this->methods();
    if (!in_array($requestMethod, (array) $methods[$webdriverCommand])) {
        throw WebDriverException::factory(WebDriverException::INVALID_REQUEST, sprintf('%s is not an available http request method for the command %s.', $requestMethod, $webdriverCommand));
    }
    $result = $this->curl($requestMethod, '/' . $webdriverCommand, array_shift($arguments));
    return $result['value'];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal