NodeContext::visitPage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
crap 2
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