@@ 363-382 (lines=20) @@ | ||
360 | * @throws ExpectationException |
|
361 | * When the node does not exist. |
|
362 | */ |
|
363 | protected function visitContentPage($op, $type, $title) { |
|
364 | $type = $this->convertLabelToNodeTypeId($type); |
|
365 | $result = \Drupal::entityQuery('node') |
|
366 | ->condition('type', $type) |
|
367 | ->condition('title', $title) |
|
368 | ->execute(); |
|
369 | ||
370 | if (!empty($result)) { |
|
371 | $nid = array_shift($result); |
|
372 | $path = [ |
|
373 | 'view' => "node/$nid", |
|
374 | 'edit' => "node/$nid/edit", |
|
375 | 'delete' => "node/$nid/delete", |
|
376 | ]; |
|
377 | $this->visitPath($path[$op]); |
|
378 | } |
|
379 | else { |
|
380 | throw new ExpectationException("No node with type '$type' and title '$title' has been found.", $this->getSession()); |
|
381 | } |
|
382 | } |
|
383 | ||
384 | /** |
|
385 | * Visit taxonomy term page given its type and name. |
|
@@ 417-436 (lines=20) @@ | ||
414 | * @throws ExpectationException |
|
415 | * When the node does not exist. |
|
416 | */ |
|
417 | protected function visitTermPage($op, $type, $title) { |
|
418 | $type = $this->convertLabelToTermTypeId($type); |
|
419 | $result = \Drupal::entityQuery('taxonomy_term') |
|
420 | ->condition('vid', $type) |
|
421 | ->condition('name', $title) |
|
422 | ->execute(); |
|
423 | ||
424 | if (!empty($result)) { |
|
425 | $tid = array_shift($result); |
|
426 | $path = [ |
|
427 | 'view' => "taxonomy/term/$tid", |
|
428 | 'edit' => "taxonomy/term/$tid/edit", |
|
429 | 'delete' => "taxonomy/term/$tid/delete", |
|
430 | ]; |
|
431 | $this->visitPath($path[$op]); |
|
432 | } |
|
433 | else { |
|
434 | throw new ExpectationException("No term with vocabulary '$type' and title '$title' has been found.", $this->getSession()); |
|
435 | } |
|
436 | } |
|
437 | ||
438 | /** |
|
439 | * Assert first element precedes second one. |
@@ 73-92 (lines=20) @@ | ||
70 | * @throws ExpectationException |
|
71 | * When the node does not exist. |
|
72 | */ |
|
73 | protected function visitContentPage($op, $type, $title) { |
|
74 | $type = $this->getCore()->convertLabelToNodeTypeId($type); |
|
75 | $result = \Drupal::entityQuery('node') |
|
76 | ->condition('type', $type) |
|
77 | ->condition('title', $title) |
|
78 | ->execute(); |
|
79 | ||
80 | if (!empty($result)) { |
|
81 | $nid = array_shift($result); |
|
82 | $path = [ |
|
83 | 'view' => "node/$nid", |
|
84 | 'edit' => "node/$nid/edit", |
|
85 | 'delete' => "node/$nid/delete", |
|
86 | ]; |
|
87 | $this->visitPath($path[$op]); |
|
88 | } |
|
89 | else { |
|
90 | throw new ExpectationException("No node with type '$type' and title '$title' has been found.", $this->getSession()); |
|
91 | } |
|
92 | } |
|
93 | ||
94 | } |
|
95 |