1 | <?php |
||
12 | trait Generic { |
||
13 | |||
14 | /** |
||
15 | * Visit taxonomy term page given its type and name. |
||
16 | * |
||
17 | * @Given I am visiting the :type term :title |
||
18 | * @Given I visit the :type term :title |
||
19 | */ |
||
20 | public function iAmViewingTheTerm($type, $title) { |
||
23 | |||
24 | /** |
||
25 | * Visit taxonomy term edit page given its type and name. |
||
26 | * |
||
27 | * @Given I am editing the :type term :title |
||
28 | * @Given I edit the :type term :title |
||
29 | */ |
||
30 | public function iAmEditingTheTerm($type, $title) { |
||
33 | |||
34 | /** |
||
35 | * Provides a common step definition callback for node pages. |
||
36 | * |
||
37 | * @param string $op |
||
38 | * The operation being performed: 'view', 'edit', 'delete'. |
||
39 | * @param string $type |
||
40 | * The node type either as id or as label. |
||
41 | * @param string $title |
||
42 | * The node title. |
||
43 | * |
||
44 | * @throws ExpectationException |
||
45 | * When the node does not exist. |
||
46 | */ |
||
47 | protected function visitTermPage($op, $type, $title) { |
||
67 | |||
68 | } |
||
69 |
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
Idable
provides a methodequalsId
that 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.