mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
NEW STEP: Pages editable by and renamed manage page permissions feature file
This commit is contained in:
parent
a79ac87e2b
commit
86301e627b
@ -47,5 +47,4 @@ class FeatureContext extends \SilverStripe\Framework\Test\Behaviour\FeatureConte
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ require_once 'PHPUnit/Framework/Assert/Functions.php';
|
|||||||
*/
|
*/
|
||||||
class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext {
|
class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find or create a redirector page and link to another existing page.
|
* Find or create a redirector page and link to another existing page.
|
||||||
* Example: Given a "page" "My Redirect" which redirects to a "page" "Page 1"
|
* Example: Given a "page" "My Redirect" which redirects to a "page" "Page 1"
|
||||||
*
|
*
|
||||||
@ -30,13 +30,13 @@ class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext
|
|||||||
public function stepCreateRedirectorPage($type, $id, $targetType, $targetId) {
|
public function stepCreateRedirectorPage($type, $id, $targetType, $targetId) {
|
||||||
$class = 'RedirectorPage';
|
$class = 'RedirectorPage';
|
||||||
$targetClass = $this->convertTypeToClass($targetType);
|
$targetClass = $this->convertTypeToClass($targetType);
|
||||||
|
|
||||||
$targetObj = $this->fixtureFactory->get($targetClass, $targetId);
|
$targetObj = $this->fixtureFactory->get($targetClass, $targetId);
|
||||||
if(!$targetObj) $targetObj = $this->fixtureFactory->get($targetClass, $targetId);
|
if (!$targetObj) $targetObj = $this->fixtureFactory->get($targetClass, $targetId);
|
||||||
|
|
||||||
$fields = array('LinkToID' => $targetObj->ID);
|
$fields = array('LinkToID' => $targetObj->ID);
|
||||||
$obj = $this->fixtureFactory->get($class, $id);
|
$obj = $this->fixtureFactory->get($class, $id);
|
||||||
if($obj) {
|
if ($obj) {
|
||||||
$obj->update($fields);
|
$obj->update($fields);
|
||||||
} else {
|
} else {
|
||||||
$obj = $this->fixtureFactory->createObject($class, $id, $fields);
|
$obj = $this->fixtureFactory->createObject($class, $id, $fields);
|
||||||
@ -44,5 +44,26 @@ class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext
|
|||||||
$obj->write();
|
$obj->write();
|
||||||
$obj->publish('Stage', 'Live');
|
$obj->publish('Stage', 'Live');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
*
|
||||||
|
* Check if the user can edit a page
|
||||||
|
*
|
||||||
|
* Example: Then pages should be editable by "Admin"
|
||||||
|
* Then pages should not be editable by "Admin"
|
||||||
|
*
|
||||||
|
* @Then /^pages should( not? |\s*)be editable by "([^"]*)"$/
|
||||||
|
*/
|
||||||
|
public function pagesShouldBeEditableBy($negative, $member){
|
||||||
|
$edit = '"/admin/pages/edit"';
|
||||||
|
$editable = 'I should'.$negative.'see an edit page form';
|
||||||
|
|
||||||
|
return array(
|
||||||
|
new Step\Given('I am not logged in'),
|
||||||
|
new Step\Given('I am logged in with "'.$member.'" permissions'),
|
||||||
|
new Step\Given('I go to '.$edit),
|
||||||
|
new Step\Given($editable),
|
||||||
|
new Step\Then('I am on the homepage')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -43,18 +43,16 @@ Scenario: I can limit global view permissions to certain groups
|
|||||||
And I go to the homepage
|
And I go to the homepage
|
||||||
Then I should see "Welcome"
|
Then I should see "Welcome"
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: I can limit global edit permissions to logged-in users
|
Scenario: I can limit global edit permissions to logged-in users
|
||||||
Given I select "Logged-in users" in "Who can edit pages on this site?" input group
|
Given I select "Anyone who can log-in to the CMS" from "Who can edit pages on this site?" input group
|
||||||
And I press the "Save" button
|
And I press the "Save" button
|
||||||
Then pages should be editable by "Content Authors"
|
Then pages should be editable by "AUTHOR"
|
||||||
And pages should be editable by "Administrators"
|
And pages should be editable by "ADMIN"
|
||||||
|
|
||||||
@todo
|
|
||||||
Scenario: I can limit global edit permissions to certain groups
|
Scenario: I can limit global edit permissions to certain groups
|
||||||
Given I select "Only these people (choose from list)" from "Who can edit pages on this site?" input group
|
Given I select "Only these people (choose from list)" from "Who can edit pages on this site?" input group
|
||||||
And I select "Administrators" from "Viewer Groups"
|
And I select "ADMIN group" from "Viewer Groups"
|
||||||
And I press the "Save" button
|
And I press the "Save" button
|
||||||
Then pages should not be editable by "Content Authors"
|
Then pages should not be editable by "AUTHOR"
|
||||||
But pages should be editable by "Administrators"
|
But pages should be editable by "ADMIN"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user