From 7cf2ff4dece999ac5cf500fcf4bda9cfe8072b60 Mon Sep 17 00:00:00 2001 From: MLoureiro Date: Tue, 15 Apr 2014 11:03:22 +0100 Subject: [PATCH 1/2] BDD: add create ContentTypeGroup feature file and sentences Add create ContentTypeGroup feature file and sentences definitions interfaces --- .../create_content_type_group.feature | 23 +++++++++ .../SentencesInterfaces/ContentTypeGroup.php | 50 +++++++++++++++++++ .../Context/SentencesInterfaces/Error.php | 28 +++++++++++ 3 files changed, 101 insertions(+) create mode 100644 src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature create mode 100644 src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php create mode 100644 src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/Error.php diff --git a/src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature b/src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature new file mode 100644 index 00000000..4bbf45ec --- /dev/null +++ b/src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature @@ -0,0 +1,23 @@ +@contenttypegroup @adminFeature +Feature: Creating a Content Type Group + Create Content Type Group + As an administrator or anonymous user + I want to create a Content Type Group + + Scenario: Create a valid Content Type Group + Given I am logged as an "administrator" + And I don't have a Content Type Group A + When I create a Content Type Group A + Then I see a Content Type Group A + + Scenario: Attempt to create a Content Type Group with same name of an existing group + Given I am logged as an "administrator" + And I have a Content Type Group A + When I create a Content Type Group A + Then I see an invalid field error + And I see 1 Content Type Group A + + Scenario: Attempt to create a Content Type Group with not authorized user + Given I am not logged in + When I create a Content Type Group A + Then I see not authorized error diff --git a/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php b/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php new file mode 100644 index 00000000..f4378ac9 --- /dev/null +++ b/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php @@ -0,0 +1,50 @@ +[A-Z])$/ + * @Given /^I have (?:a |)Content Type Group with "(?P[^"])" identifier$/ + */ + public function iHaveContentTypeGroup( $identifier ); + + /** + * @Given /^I (?:do not|don\'t) have a Content Type Group (?P[A-Z])$/ + * @Given /^I (?:do not|don\'t) have a Content Type Group with "(?P[^"])" identifier$/ + */ + public function iDonTHaveContentTypeGroup( $identifier ); + + /** + * @When /^I create a Content Type Group (?P[A-Z])$/ + * @When /^I create a Content Type Group with "(?P[^"])" identifier$/ + */ + public function iCreateContentTypeGroup( $identifier ); + + /** + * @Then /^I see a Content Type Group (?P[A-Z])$/ + * @Then /^I see a Content Type Group with "(?P[^"])" identifier$/ + */ + public function iSeeContentTypeGroup( $identifier ); + + /** + * @Then /^I see (?P\d+) Content Type Group(?:s|) (?P[A-Z])$/ + * @Then /^I see (?P\d+) Content Type Group(?:s|) with "(?P[^"])" identifier$/ + */ + public function iSeeTotalContentTypeGroup( $total, $identifier ); +} diff --git a/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/Error.php b/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/Error.php new file mode 100644 index 00000000..44ced32d --- /dev/null +++ b/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/Error.php @@ -0,0 +1,28 @@ + Date: Tue, 15 Apr 2014 12:02:33 +0100 Subject: [PATCH 2/2] BDD: update single identifier sentences with "" --- .../create_content_type_group.feature | 14 +++++++------- .../SentencesInterfaces/ContentTypeGroup.php | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature b/src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature index 4bbf45ec..b970f4f0 100644 --- a/src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature +++ b/src/EzSystems/BehatBundle/Features/ContentTypeGroup/create_content_type_group.feature @@ -6,18 +6,18 @@ Feature: Creating a Content Type Group Scenario: Create a valid Content Type Group Given I am logged as an "administrator" - And I don't have a Content Type Group A - When I create a Content Type Group A - Then I see a Content Type Group A + And I don't have a Content Type Group "A" + When I create a Content Type Group "A" + Then I see a Content Type Group "A" Scenario: Attempt to create a Content Type Group with same name of an existing group Given I am logged as an "administrator" - And I have a Content Type Group A - When I create a Content Type Group A + And I have a Content Type Group "A" + When I create a Content Type Group "A" Then I see an invalid field error - And I see 1 Content Type Group A + And I see 1 Content Type Group "A" Scenario: Attempt to create a Content Type Group with not authorized user Given I am not logged in - When I create a Content Type Group A + When I create a Content Type Group "A" Then I see not authorized error diff --git a/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php b/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php index f4378ac9..17f07540 100644 --- a/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php +++ b/src/EzSystems/BehatBundle/Features/Context/SentencesInterfaces/ContentTypeGroup.php @@ -19,31 +19,31 @@ interface ContentTypeGroup { /** - * @Given /^I have (?:a |)Content Type Group (?P[A-Z])$/ + * @Given /^I have (?:a |)Content Type Group "(?P[A-Z])"$/ * @Given /^I have (?:a |)Content Type Group with "(?P[^"])" identifier$/ */ public function iHaveContentTypeGroup( $identifier ); /** - * @Given /^I (?:do not|don\'t) have a Content Type Group (?P[A-Z])$/ + * @Given /^I (?:do not|don\'t) have a Content Type Group "(?P[A-Z])"$/ * @Given /^I (?:do not|don\'t) have a Content Type Group with "(?P[^"])" identifier$/ */ public function iDonTHaveContentTypeGroup( $identifier ); /** - * @When /^I create a Content Type Group (?P[A-Z])$/ + * @When /^I create a Content Type Group "(?P[A-Z])"$/ * @When /^I create a Content Type Group with "(?P[^"])" identifier$/ */ public function iCreateContentTypeGroup( $identifier ); /** - * @Then /^I see a Content Type Group (?P[A-Z])$/ + * @Then /^I see a Content Type Group "(?P[A-Z])"$/ * @Then /^I see a Content Type Group with "(?P[^"])" identifier$/ */ public function iSeeContentTypeGroup( $identifier ); /** - * @Then /^I see (?P\d+) Content Type Group(?:s|) (?P[A-Z])$/ + * @Then /^I see (?P\d+) Content Type Group(?:s|) "(?P[A-Z])"$/ * @Then /^I see (?P\d+) Content Type Group(?:s|) with "(?P[^"])" identifier$/ */ public function iSeeTotalContentTypeGroup( $total, $identifier );