Mercurial > hg > cmmr2012-drupal-site
comparison vendor/behat/mink/src/Exception/ElementNotFoundException.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 /* | |
4 * This file is part of the Mink package. | |
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com> | |
6 * | |
7 * For the full copyright and license information, please view the LICENSE | |
8 * file that was distributed with this source code. | |
9 */ | |
10 | |
11 namespace Behat\Mink\Exception; | |
12 | |
13 use Behat\Mink\Driver\DriverInterface; | |
14 use Behat\Mink\Session; | |
15 | |
16 /** | |
17 * Exception thrown when an expected element is not found. | |
18 * | |
19 * @author Konstantin Kudryashov <ever.zet@gmail.com> | |
20 */ | |
21 class ElementNotFoundException extends ExpectationException | |
22 { | |
23 /** | |
24 * Initializes exception. | |
25 * | |
26 * @param DriverInterface|Session $driver driver instance | |
27 * @param string $type element type | |
28 * @param string $selector element selector type | |
29 * @param string $locator element locator | |
30 */ | |
31 public function __construct($driver, $type = null, $selector = null, $locator = null) | |
32 { | |
33 $message = ''; | |
34 | |
35 if (null !== $type) { | |
36 $message .= ucfirst($type); | |
37 } else { | |
38 $message .= 'Tag'; | |
39 } | |
40 | |
41 if (null !== $locator) { | |
42 if (null === $selector || in_array($selector, array('css', 'xpath'))) { | |
43 $selector = 'matching '.($selector ?: 'locator'); | |
44 } else { | |
45 $selector = 'with '.$selector; | |
46 } | |
47 $message .= ' '.$selector.' "'.$locator.'"'; | |
48 } | |
49 | |
50 $message .= ' not found.'; | |
51 | |
52 parent::__construct($message, $driver); | |
53 } | |
54 } |