| 1 | <?php |
||
| 15 | trait ClickTrait |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Clicks on a link |
||
| 19 | * |
||
| 20 | * @param string $linkText |
||
| 21 | * @param callable $callback |
||
| 22 | * @param float $sleep |
||
| 23 | * @return $this |
||
| 24 | */ |
||
| 25 | protected function clickLink($linkText, callable $callback = null, $sleep = 2.0) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Clicks on ajax-link |
||
| 36 | * |
||
| 37 | * @param string $linkText |
||
| 38 | * @param callable $callback |
||
| 39 | * @return $this |
||
| 40 | */ |
||
| 41 | protected function clickAjaxLink($linkText, callable $callback = null) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $class |
||
| 50 | * @return $this |
||
| 51 | */ |
||
| 52 | protected function clickByClass($class) |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param string $name |
||
| 60 | * @param string $value |
||
| 61 | * @return $this |
||
| 62 | * @deprecated use getSelect() |
||
| 63 | */ |
||
| 64 | protected function clickSelect($name, $value) |
||
| 70 | } |
||
| 71 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.