Skip to content

Commit

Permalink
Merge pull request #66 from Charlie-Lucas/master
Browse files Browse the repository at this point in the history
fix cache for pages and added some pages tests
  • Loading branch information
Charlie-Lucas committed Apr 21, 2015
2 parents 7a05b05 + c0a5ebe commit f1d74f8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions Bundle/PageBundle/EventSubscriber/PageSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function onFlush(OnFlushEventArgs $eventArgs)
$this->buildUrl($entity);
$meta = $this->entityManager->getClassMetadata(get_class($entity));
$this->uow->computeChangeSet($meta, $entity);
$this->updateCache($entity);
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions Tests/Features/Context/SubContext/VictoireSubContextTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public function iSubmitTheWidget()
{

$element = $this->getSession()->getPage()->find('xpath', 'descendant-or-self::*[@class="vic-modal-footer-content"]/a[@data-modal="create"]');
if(!$element){
$element = $this->getSession()->getPage()->find('xpath', 'descendant-or-self::*[@class="vic-modal-footer-content"]/a[@data-modal="update"]');
}
$element->click();
}

Expand All @@ -91,4 +94,14 @@ function($element) {

}

/**
* @When /^I select the option "(?P<option>[^"]*)" in the dropdown "(?P<dropdown>[^"]*)"$/
*/
public function iSelectTheOptionInTheDropdown($option, $dropdown)
{
$link = $this->getSession()->getPage()->find("xpath", "descendant-or-self::a[text()[normalize-space(.)='".$dropdown."']]");
$optionButton = $this->getSession()->getPage()->find("xpath", "descendant-or-self::a[text()[normalize-space(.)='$option']]");
$link->click();
$optionButton->click();
}
}
27 changes: 27 additions & 0 deletions Tests/Features/page.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@mink:selenium2
Feature: Create a page

Background:
Given I am logged in as "[email protected]"

Scenario: I can create a new page
Given I should see "Page"
Given I select the option "Nouvelle page" in the dropdown "Page"
And I should see "Créer"
And I fill in "Nom" with "tatooine"
Then I submit the widget
And the url should match "/fr/"
And I am on "/tatooine"
And I should see "Victoire"

Scenario: I can change name and Then the url should match "<pattern>"
Given I am on "/fr/tatooine"
And I select the option "Paramètres de la page" in the dropdown "Page"
And I should see "Mettre à jour"
Then I fill in "Nom" with "anoth"
Then I fill in "victoire_page_settings_type_slug" with "anoth"
And I submit the widget
And the url should match "/fr/"
And I am on "/anoth"
And I should see "Victoire"

0 comments on commit f1d74f8

Please sign in to comment.