Пример #1
0
 /**
  * Initializes exception.
  *
  * @param string                  $message   optional message
  * @param DriverInterface|Session $driver    driver instance (or session for BC)
  * @param \Exception|null         $exception expectation exception
  */
 public function __construct($message, $driver, \Exception $exception = null)
 {
     if ($driver instanceof Session) {
         @trigger_error('Passing a Session object to the ExpectationException constructor is deprecated as of Mink 1.7. Pass the driver instead.', E_USER_DEPRECATED);
         $this->session = $driver;
         $this->driver = $driver->getDriver();
     } elseif (!$driver instanceof DriverInterface) {
         // Trigger an exception as we cannot typehint a disjunction
         throw new \InvalidArgumentException('The ExpectationException constructor expects a DriverInterface or a Session.');
     } else {
         $this->driver = $driver;
     }
     if (!$message && null !== $exception) {
         $message = $exception->getMessage();
     }
     parent::__construct($message, 0, $exception);
 }