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

Breadcrumb

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

function ExpectationException::__construct

Initializes exception.

Parameters

string $message optional message:

DriverInterface|Session $driver driver instance (or session for BC):

\Throwable|null $exception expectation exception:

4 calls to ExpectationException::__construct()
ElementHtmlException::__construct in vendor/behat/mink/src/Exception/ElementHtmlException.php
Initializes exception.
ElementHtmlException::__construct in vendor/behat/mink/src/Exception/ElementHtmlException.php
Initializes exception.
ElementNotFoundException::__construct in vendor/behat/mink/src/Exception/ElementNotFoundException.php
Initializes exception.
ElementNotFoundException::__construct in vendor/behat/mink/src/Exception/ElementNotFoundException.php
Initializes exception.
2 methods override ExpectationException::__construct()
ElementHtmlException::__construct in vendor/behat/mink/src/Exception/ElementHtmlException.php
Initializes exception.
ElementNotFoundException::__construct in vendor/behat/mink/src/Exception/ElementNotFoundException.php
Initializes exception.

File

vendor/behat/mink/src/Exception/ExpectationException.php, line 41

Class

ExpectationException
Exception thrown for failed expectations.

Namespace

Behat\Mink\Exception

Code

public function __construct(string $message, $driver, ?\Throwable $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);
}

API Navigation

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