public/phpmyadmin/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumTestCase/Driver.php
/**
     * Send a command to the Selenium RC server.
     *
     * @param  string $command
     * @param  array  $arguments
     * @param  array  $namedArguments
     * @return string
     * @author Seth Casana <totallymeat@gmail.org>
     */
Send a command to the Selenium RC server.
Send a command to the Selenium RC server .
protected function doCommand($command, array $arguments = array(), array $namedArguments = array())
    {
        $url = sprintf(
          'http://%s:%s/selenium-server/driver/',
          $this->host,
          $this->port
        );
        $numArguments = count($arguments);
        $postData = sprintf('cmd=%s', urlencode($command));
        for ($i = 0; $i < $numArguments; $i++) {
            $argNum = strval($i + 1);
            if ($arguments[$i] == ' ') {
                $postData .= sprintf('&%s=%s', $argNum, urlencode($arguments[$i]));
            } else {
                $postData .= sprintf('&%s=%s', $argNum, urlencode(trim($arguments[$i])));
            }
        }
        foreach ($namedArguments as $key => $value) {
            $postData .= sprintf('&%s=%s', $key, urlencode($value));
        }
        if (isset($this->sessionId)) {
            $postData .= sprintf('&%s=%s', 'sessionId', $this->sessionId);
        }
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_POST, TRUE);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
        ));
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
        $response = curl_exec($curl);
        $info     = curl_getinfo($curl);
        if (!$response) {
            throw new RuntimeException("CURL error while accessing the Selenium Server at '$url': " . curl_error($curl));
        }
        curl_close($curl);
        if (!preg_match('/^OK/', $response)) {
            throw new RuntimeException("Invalid response while accessing the Selenium Server at '$url': " . $response);
        }
        if ($info['http_code'] != 200) {
            throw new RuntimeException(
              'The response from the Selenium RC server is invalid: ' .
              $response
            );
        }
        return $response;
    }
protected function doCommand ( $ command , array $ arguments = array ( ) , array $ namedArguments = array ( ) ) { $ url = sprintf ( 'http://%s:%s/selenium-server/driver/' , $ this -> host , $ this -> port ) ; $ numArguments = count ( $ arguments ) ; $ postData = sprintf ( 'cmd=%s' , urlencode ( $ command ) ) ; for ( $ i = 0 ; $ i < $ numArguments ; $ i ++ ) { $ argNum = strval ( $ i + 1 ) ; if ( $ arguments [ $ i ] == ' ' ) { $ postData .= sprintf ( '&%s=%s' , $ argNum , urlencode ( $ arguments [ $ i ] ) ) ; } else { $ postData .= sprintf ( '&%s=%s' , $ argNum , urlencode ( trim ( $ arguments [ $ i ] ) ) ) ; } } foreach ( $ namedArguments as $ key => $ value ) { $ postData .= sprintf ( '&%s=%s' , $ key , urlencode ( $ value ) ) ; } if ( isset ( $ this -> sessionId ) ) { $ postData .= sprintf ( '&%s=%s' , 'sessionId' , $ this -> sessionId ) ; } $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , $ url ) ; curl_setopt ( $ curl , CURLOPT_HEADER , 0 ) ; curl_setopt ( $ curl , CURLOPT_POST , TRUE ) ; curl_setopt ( $ curl , CURLOPT_POSTFIELDS , $ postData ) ; curl_setopt ( $ curl , CURLOPT_HTTPHEADER , array ( 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' ) ) ; curl_setopt ( $ curl , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ curl , CURLOPT_CONNECTTIMEOUT , 60 ) ; $ response = curl_exec ( $ curl ) ; $ info = curl_getinfo ( $ curl ) ; if ( ! $ response ) { throw new RuntimeException ( " CURL error while accessing the Selenium Server at ' $ url ':  " . curl_error ( $ curl ) ) ; } curl_close ( $ curl ) ; if ( ! preg_match ( '/^OK/' , $ response ) ) { throw new RuntimeException ( " Invalid response while accessing the Selenium Server at ' $ url ':  " . $ response ) ; } if ( $ info [ 'http_code' ] != 200 ) { throw new RuntimeException ( 'The response from the Selenium RC server is invalid: ' . $ response ) ; } return $ response ; }
Send a command to the Selenium RC server.
Send a command to the Selenium RC server .