Add register feature

This commit is contained in:
Nicolas Le Goff
2013-03-12 14:55:15 +01:00
committed by Romain Neutron
parent d409bd0586
commit 341a54fd69
2 changed files with 75 additions and 0 deletions

View File

@@ -123,4 +123,51 @@ class GuiContext extends MinkContext
{
$this->app['phraseanet.registry']->set('GV_captchas', false, \registry::TYPE_BOOLEAN);
}
/**
* @Given /^user registration is enable$/
*/
public function userRegistrationIsEnable()
{
$databox = current($this->app['phraseanet.appbox']->get_databoxes());
$xml = $databox->get_sxml_structure();
if (!$xml) {
throw new \Exception('Invalid databox xml structure');
}
if (!isset($xml->caninscript)) {
$xml->addChild('caninscript', '1');
$dom = new \DOMDocument();
$dom->loadXML($xml->asXML());
$databox->saveStructure($dom);
}
}
/**
* @Given /^user registration is disable/
*/
public function userRegistrationIsDisable()
{
$databox = current($this->app['phraseanet.appbox']->get_databoxes());
$xml = $databox->get_sxml_structure();
if (!$xml) {
throw new \Exception('Invalid databox xml structure');
}
if (isset($xml->caninscript)) {
unset($xml->caninscript);
$dom = new \DOMDocument();
$dom->loadXML($xml->asXML());
$databox->saveStructure($dom);
}
}
}

28
features/register.feature Normal file
View File

@@ -0,0 +1,28 @@
Feature: Register
In order to register myself into the application
As a non authenticated user
I need to be able to submit a register form
Scenario: Give access to register page
Given user registration is enable
And I am not authenticated
And I am on "/login/"
Then I should see an "a#link-register" element
Scenario: Restrict access to register page if registration is not enable
Given user registration is disable
And I am not authenticated
And I am on "/login/register/"
Then I should see "Registration is not available"
Scenario: Register form is displayed
Given user registration is enable
And I am not authenticated
And I am on "/login/register/"
Then I should see an "a#register-classic" element
When I follow "a#register-classic"
Then I should see "firstName"
And I should see "lastName"
And I should see "email"
And I should see "job"
And I should see "company"