Completed
Push — master ( a36a2e...782846 )
by Sergii
05:45
created

NodeContext   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 1 Features 1
Metric Value
wmc 1
c 1
b 1
f 1
lcom 0
cbo 2
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A visitPage() 0 7 1
1
<?php
2
/**
3
 * @author Sergii Bondarenko, <[email protected]>
4
 */
5
namespace Drupal\TqExtension\Context\Node;
6
7
class NodeContext extends RawNodeContext
8
{
9
    /**
10
     * @param string $operation
11
     *   Allowable values: "edit", "view", "visit".
12
     * @param string $nid
13
     *   Node ID or inaccurate title.
14
     * @param string $contentType
15
     *   Content type, for additional filter of a search query.
16
     *
17
     * @When /^(?:|I )(visit|view|edit) (?:the "([^"]+)"|current) node(?:| of type "([^"]+)")$/
18
     */
19
    public function visitPage($operation, $nid = '', $contentType = '')
20
    {
21
        // This helps us restrict an access for editing for users without correct permissions.
22
        // Will check for 403 HTTP status code.
23
        $this->getRedirectContext()
24
            ->visitPage($this->entityUrl($operation, $nid, $contentType));
25
    }
26
}
27