[Admin] Prevent from adding inconsistent routes to the store

This commit is contained in:
Kamil Kokot 2016-07-05 14:35:22 +02:00
parent 4a5ce5c66c
commit 8cb82262a3
No known key found for this signature in database
GPG key ID: 7BD76F7054D93C89
2 changed files with 28 additions and 2 deletions

View file

@ -8,10 +8,10 @@ Feature: Routes validation
Given the store has static content "Krzysztof Krawczyk"
And I am logged in as an administrator
@ui @todo
@ui
Scenario: Trying to add a new route without specifying its name
Given I want to add a new route
When I choose "Krzysztof Krawczyk" as its content
And I add it
Then I should be notified that name is required
And the route "krzysztof-krawczyk" should not be added
And the route with content "Krzysztof Krawczyk" should not be added

View file

@ -182,4 +182,30 @@ final class ManagingRoutesContext implements Context
sprintf('Cannot find route with name "%s" and content "%s" assigned.', $route->getName(), $contentTitle)
);
}
/**
* @Then I should be notified that name is required
*/
public function iShouldBeNotifiedThatElementIsRequired()
{
Assert::same(
$this->createPage->getValidationMessage('name'),
'This value should not be blank.'
);
}
/**
* @Then the route with content :title should not be added
*/
public function theRouteWithContentShouldNotBeAdded($title)
{
if (!$this->indexPage->isOpen()) {
$this->indexPage->open();
}
Assert::false(
$this->indexPage->isSingleResourceOnPage(['content' => $title]),
sprintf('Found route with content "%s" assigned, but expected not to.', $title)
);
}
}