@@ 98-105 (lines=8) @@ | ||
95 | * @Then :name can :op content :content |
|
96 | * @Then :name can :op :content content |
|
97 | */ |
|
98 | public function userCanContent($name, $op, $title) { |
|
99 | $op = strtr($op, ['edit' => 'update']); |
|
100 | $node = $this->getCore()->loadNodeByName($title); |
|
101 | $access = $this->getCore()->nodeAccess($op, $name, $node); |
|
102 | if (!$access) { |
|
103 | throw new \Exception("{$name} cannot {$op} '{$title}' but it is supposed to."); |
|
104 | } |
|
105 | } |
|
106 | ||
107 | /** |
|
108 | * Assert that given user cannot perform given operation on given content. |
|
@@ 124-131 (lines=8) @@ | ||
121 | * @Then :name cannot :op content :content |
|
122 | * @Then :name cannot :op :content content |
|
123 | */ |
|
124 | public function userCanNotContent($name, $op, $title) { |
|
125 | $op = strtr($op, ['edit' => 'update']); |
|
126 | $node = $this->getCore()->loadNodeByName($title); |
|
127 | $access = $this->getCore()->nodeAccess($op, $name, $node); |
|
128 | if ($access) { |
|
129 | throw new \Exception("{$name} can {$op} '{$title}' but it is not supposed to."); |
|
130 | } |
|
131 | } |
|
132 | ||
133 | /** |
|
134 | * Assert presence of content edit link given its name and content title. |