Ejemplo n.º 1
0
 /**
  * PHP magic method.
  * This method is overridden so that named fixture ActiveRecord instances can be accessed in terms of a method call.
  * @param string $name method name
  * @param string $params method parameters
  * @return mixed the property value
  */
 public function __call($name, $params)
 {
     if (is_array($this->fixtures) && isset($params[0]) && ($record = $this->getFixtureManager()->getRecord($name, $params[0])) !== false) {
         return $record;
     } else {
         return parent::__call($name, $params);
     }
 }
Ejemplo n.º 2
0
 /**
  * @method PHPUnit_Extensions_Story_Step and($contextOrOutcome)
  */
 public function __call($command, $arguments)
 {
     switch ($command) {
         case 'and':
             return $this->scenario->_and($arguments);
             break;
         default:
             return parent::__call($command, $arguments);
     }
 }
 /**
  * Delegate method calls to the driver and overridden to allow load tests helpers
  *
  * @param string $command    Command's (method's) name to call
  * @param array  $arguments  Arguments for send to called command (method)
  *
  * @return mixed
  */
 public function __call($command, $arguments)
 {
     if (version_compare(phpversion(), '5.3.0', '<') === true) {
         $helper = false;
         $pos = strpos($command, 'Helper');
         if ($pos !== false) {
             $helper = substr($command, 0, $pos);
         }
     } else {
         $helper = strstr($command, 'Helper', true);
     }
     if ($helper !== false) {
         $helper = $this->_loadHelper($helper);
         if ($helper) {
             return $helper;
         }
     }
     return parent::__call($command, $arguments);
 }
Ejemplo n.º 4
0
 /**
  * Delegate method calls to the driver. Overridden to load test helpers
  *
  * @param string $command Command (method) name to call
  * @param array $arguments Arguments to be sent to the called command (method)
  *
  * @return mixed
  */
 public function __call($command, $arguments)
 {
     $helper = substr($command, 0, strpos($command, 'Helper'));
     if ($helper) {
         $helper = $this->_loadHelper($helper);
         if ($helper) {
             return $helper;
         }
     }
     return parent::__call($command, $arguments);
 }
 /**
  * Magic method to check for PHP Notice whenever the waitForPageToLoad command is invoked
  * To suppress the check, use waitForPageToLoad('3000', false);
  *
  * @param string $command
  * @param array $arguments
  * @return results of waitForPageToLoad method
  */
 public function __call($command, $arguments)
 {
     $return = parent::__call($command, $arguments);
     if ($command == 'waitForPageToLoad' && (!isset($arguments[1]) || $arguments[1] !== false)) {
         try {
             $this->assertFalse($this->isTextPresent("( ! ) Notice"), "**Warning: PHP Notice found on page!");
         } catch (PHPUnit_Framework_AssertionFailedError $e) {
             echo "**Warning: PHP Notice found on page\n";
             array_push($this->verificationErrors, $this->getTraceFiles($e));
         }
     }
     return $return;
 }
Ejemplo n.º 6
0
 /**
  * Common command interrupter
  *
  * @param string $command   Command name
  * @param array  $arguments Arguments array
  *
  * @return mixed
  * @access public
  * @see    ____func_see____
  * @since  1.0.0
  */
 public function __call($command, $arguments)
 {
     $result = null;
     try {
         $result = parent::__call($command, $arguments);
         if (preg_match('/^open(?:AndWait)?$/Ssi', $command) && $this->validatePage) {
             $url = $arguments[0];
             if (!isset(static::$validatedPages[$url])) {
                 static::$validatedPages[$url] = true;
                 $this->validate();
             }
         }
     } catch (RuntimeException $e) {
         $message = $e->getMessage();
         if (isset($arguments) && !empty($arguments)) {
             $_arguments = $arguments;
             $param = (string) array_shift($_arguments);
         } else {
             $param = '';
         }
         echo "\n{$command}('{$param}') [ERROR] {$message}\n";
         /*
                     if (
            preg_match('/Could not connect to the Selenium RC server/', $message)
            || preg_match('/^The response from the Selenium RC server is invalid: Timed out after \d+ms$/Ss', $message)
                     ) {
         
            if ($command == 'waitForCondition') {
                $this->fail(
                    'Timeout failed (' . $arguments[1] . 'ms): '
                    . (isset($arguments[2]) ? $arguments[2] : $arguments[0])
                );
         
            } elseif (preg_match('/AndWait$/Ss', $command)) {
                $this->fail(
                    'Timeout failed for ' . $command . ' command with pattern ' . $arguments[0]
                );
         
            } elseif (!defined('DEPLOYMENT_TEST')) {
                $this->markTestSkipped($e->getMessage());
         
            } else {
                $this->fail($e->getMessage());
            }
         */
         //            } elseif (preg_match('/this\.getCurrentWindow is not a function/', $message)) {
         //                $this->markTestSkipped('Browser down: ' . $e->getMessage());
         //            } else {
         throw $e;
         //            }
     }
     return $result;
 }
 public function __call($command, $arguments)
 {
     $ret = parent::__call($command, $arguments);
     return $ret;
 }