Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Behat\Mink\Exception; Chris@0: Chris@0: use Behat\Mink\Driver\DriverInterface; Chris@0: use Behat\Mink\Element\Element; Chris@0: use Behat\Mink\Session; Chris@0: Chris@0: /** Chris@0: * Exception thrown when an expectation on the HTML of an element fails. Chris@0: * Chris@0: * @author Konstantin Kudryashov Chris@0: */ Chris@0: class ElementHtmlException extends ExpectationException Chris@0: { Chris@0: /** Chris@0: * Element instance. Chris@0: * Chris@0: * @var Element Chris@0: */ Chris@0: protected $element; Chris@0: Chris@0: /** Chris@0: * Initializes exception. Chris@0: * Chris@0: * @param string $message optional message Chris@0: * @param DriverInterface|Session $driver driver instance Chris@0: * @param Element $element element Chris@0: * @param \Exception $exception expectation exception Chris@0: */ Chris@0: public function __construct($message, $driver, Element $element, \Exception $exception = null) Chris@0: { Chris@0: $this->element = $element; Chris@0: Chris@0: parent::__construct($message, $driver, $exception); Chris@0: } Chris@0: Chris@0: protected function getContext() Chris@0: { Chris@0: return $this->element->getOuterHtml(); Chris@0: } Chris@0: }