public function __construct($jsonParameters, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     if (is_string($jsonParameters)) {
         $jsonParameters = $this->charactersToType($jsonParameters);
     }
     parent::__construct($jsonParameters, $url);
 }
 public function __construct($jsonParameters, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     if ($jsonParameters === NULL) {
         parent::__construct(NULL, $url);
     } else {
         $jsonParameters = $this->keysForText($jsonParameters);
         parent::__construct($jsonParameters, $url);
     }
 }
Exemple #3
0
 public function __construct($element, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     if ($element instanceof PHPUnit_Extensions_Selenium2TestCase_Element) {
         $jsonParameters = array('element' => $element->getId());
     } else {
         throw new PHPUnit_Extensions_Selenium2TestCase_Exception('Only moving over an element is supported. Please pass a PHPUnit_Extensions_Selenium2TestCase_Element instance.');
     }
     parent::__construct($jsonParameters, $url);
 }
Exemple #4
0
 public function __construct($url, $commandUrl, PHPUnit_Extensions_Selenium2TestCase_URL $baseUrl)
 {
     if ($url !== NULL) {
         $absoluteLocation = $baseUrl->jump($url)->getValue();
         $jsonParameters = array('url' => $absoluteLocation);
     } else {
         $jsonParameters = NULL;
     }
     parent::__construct($jsonParameters, $commandUrl);
 }
 public function __construct($relativeUrl, $commandUrl, $baseUrl)
 {
     if ($relativeUrl !== NULL) {
         $absoluteLocation = $baseUrl->addCommand($relativeUrl)->getValue();
         $jsonParameters = array('url' => $absoluteLocation);
     } else {
         $jsonParameters = NULL;
     }
     parent::__construct($jsonParameters, $commandUrl);
 }
Exemple #6
0
 public function __construct($argument, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     if (is_null($argument)) {
         $jsonParameters = NULL;
     } elseif (!is_scalar($argument) || !in_array($argument, array(self::LEFT, self::RIGHT, self::MIDDLE))) {
         throw new BadMethodCallException('Wrong parameter for click(): expecting 0, 1 or 2.');
     } else {
         $jsonParameters = array('button' => $argument);
     }
     parent::__construct($jsonParameters, $url);
 }
 public function __construct($argument, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     if (is_string($argument)) {
         $jsonParameters = array('text' => $argument);
     } else {
         if ($argument == NULL) {
             $jsonParameters = NULL;
         } else {
             throw new BadMethodCallException('Wrong parameters for alertText().');
         }
     }
     parent::__construct($jsonParameters, $url);
 }
Exemple #8
0
 public function __construct($name, $commandUrl)
 {
     if (is_string($name)) {
         $jsonParameters = array('name' => $name);
     } else {
         if ($name == NULL) {
             $jsonParameters = NULL;
         } else {
             throw new BadMethodCallException("Wrong Parameters for context().");
         }
     }
     parent::__construct($jsonParameters, $commandUrl);
 }
Exemple #9
0
 public function __construct($argument, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     if (!is_file($argument)) {
         throw new BadMethodCallException("No such file: {$argument}");
     }
     $zipfile_path = $this->_zipArchiveFile($argument);
     $contents = file_get_contents($zipfile_path);
     if ($contents === false) {
         throw new Exception("Unable to read generated zip file: {$zipfile_path}");
     }
     $file = base64_encode($contents);
     parent::__construct(array('file' => $file), $url);
     unlink($zipfile_path);
 }
Exemple #10
0
 public function __construct($element, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     if (!is_array($element)) {
         $element = array('element' => $element);
     }
     $validKeys = array('element' => NULL, 'xoffset' => NULL, 'yoffset' => NULL);
     $jsonParameters = array_intersect_key($element, $validKeys);
     if (isset($jsonParameters['element'])) {
         if (!$jsonParameters['element'] instanceof PHPUnit_Extensions_Selenium2TestCase_Element) {
             throw new PHPUnit_Extensions_Selenium2TestCase_Exception('Only moving over an element is supported. Please pass a PHPUnit_Extensions_Selenium2TestCase_Element instance.');
         }
         $jsonParameters['element'] = $jsonParameters['element']->getId();
     }
     if (isset($jsonParameters['xoffset']) || isset($jsonParameters['yoffset'])) {
         // @see https://github.com/sebastianbergmann/phpunit-selenium/pull/250#issuecomment-21308153
         // @see https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/moveto
         error_log('Even though this method is a part of the WebDriver Wire protocol it might be not supported by your browser yet');
     }
     parent::__construct($jsonParameters, $url);
 }
 public function execute(PHPUnit_Extensions_Selenium2TestCase_Command $command)
 {
     return $this->curl($command->httpMethod(), $command->url(), $command->jsonParameters());
 }
 public function __construct($id, $commandUrl)
 {
     $jsonParameters = array('id' => $id);
     parent::__construct($jsonParameters, $commandUrl);
 }
Exemple #13
0
 public function __construct($type, $commandUrl)
 {
     $jsonParameters = array('type' => $type);
     parent::__construct($jsonParameters, $commandUrl);
 }
Exemple #14
0
 public function __construct($jsonParameters, PHPUnit_Extensions_Selenium2TestCase_URL $url)
 {
     $url = $url->addCommand('element')->addCommand('active');
     parent::__construct($jsonParameters, $url);
 }