[Behat][Taxon] Specify taxon slug in specific language

This commit is contained in:
Mateusz Zalewski 2016-11-17 15:48:34 +01:00
parent 7659db0514
commit f3485e4ec3
No known key found for this signature in database
GPG key ID: CFC1E4176165876B
10 changed files with 23 additions and 15 deletions

View file

@ -13,7 +13,7 @@ Feature: Adding a new taxon
Given I want to create a new taxon
When I specify its code as "t-shirts"
And I name it "T-Shirts" in "English (United States)"
And I set its slug to "t-shirts"
And I set its slug to "t-shirts" in "English (United States)"
And I add it
Then I should be notified that it has been successfully created
And the "T-Shirts" taxon should appear in the registry
@ -23,7 +23,7 @@ Feature: Adding a new taxon
Given I want to create a new taxon
When I specify its code as "category"
And I name it "Category" in "English (United States)"
And I set its slug to "category"
And I set its slug to "category" in "English (United States)"
And I describe it as "Main taxonomy for products." in "English (United States)"
And I add it
Then I should be notified that it has been successfully created

View file

@ -14,7 +14,7 @@ Feature: Adding a new taxon for parent
Given I want to create a new taxon for "Category"
And I specify its code as "guns"
And I name it "Guns" in "English (United States)"
And I set its slug to "guns"
And I set its slug to "guns" in "English (United States)"
And I add it
Then I should be notified that it has been successfully created
And the "Guns" taxon should appear in the registry

View file

@ -31,7 +31,7 @@ Feature: Editing a taxon
Given I want to modify the "T-Shirts" taxon
When I rename it to "Stickers" in "English (United States)"
And I change its description to "Main taxonomy for stickers" in "English (United States)"
And I set its slug to "stickers"
And I set its slug to "stickers" in "English (United States)"
And I change its parent taxon to "Accessories"
And I save my changes
Then I should be notified that it has been successfully edited

View file

@ -21,7 +21,7 @@ Feature: Editing taxon's slug
Given I want to create a new taxon
When I specify its code as "MEDIEVAL_WEAPONS"
And I name it "Medieval weapons" in "English (United States)"
And I set its slug to "mw"
And I set its slug to "mw" in "English (United States)"
And I add it
Then this taxon slug should be "mw"
@ -40,7 +40,7 @@ Feature: Editing taxon's slug
And I want to create a new taxon for "Medieval weapons"
When I specify its code as "SIEGE_ENGINES"
And I name it "Siege engines" in "English (United States)"
And I set its slug to "medieval-weapons/siege"
And I set its slug to "medieval-weapons/siege" in "English (United States)"
And I add it
Then this taxon slug should be "medieval-weapons/siege"
@ -73,7 +73,7 @@ Feature: Editing taxon's slug
When I want to modify the "Medieval weapons" taxon
And I enable slug modification
And I rename it to "Renaissance weapons" in "English (United States)"
And I set its slug to "renaissance"
And I set its slug to "renaissance" in "English (United States)"
And I save my changes
Then the slug of the "Renaissance weapons" taxon should be "renaissance"

View file

@ -126,8 +126,9 @@ final class ManagingTaxonsContext implements Context
/**
* @When I set its slug to :slug
* @When I do not specify its slug
* @When I set its slug to :slug in :language
*/
public function iSetItsSlugTo($slug = null)
public function iSetItsSlugToIn($slug = null, $language = 'en_US')
{
/** @var CreatePageInterface|UpdatePageInterface $currentPage */
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([
@ -136,7 +137,7 @@ final class ManagingTaxonsContext implements Context
$this->updatePage,
]);
$currentPage->specifySlug($slug);
$currentPage->specifySlug($slug, $language);
}
/**

View file

@ -105,9 +105,9 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
/**
* {@inheritdoc}
*/
public function specifySlug($slug)
public function specifySlug($slug, $languageCode)
{
$this->getDocument()->fillField('Slug', $slug);
$this->getDocument()->fillField(sprintf('sylius_taxon_translations_%s_slug', $languageCode), $slug);
}
/**

View file

@ -72,8 +72,9 @@ interface CreatePageInterface extends BaseCreatePageInterface
/**
* @param string $slug
* @param string $languageCode
*/
public function specifySlug($slug);
public function specifySlug($slug, $languageCode);
/**
* @param string $path

View file

@ -55,9 +55,9 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
/**
* {@inheritdoc}
*/
public function specifySlug($slug)
public function specifySlug($slug, $languageCode)
{
$this->getDocument()->fillField('Slug', $slug);
$this->getDocument()->fillField(sprintf('sylius_taxon_translations_%s_slug', $languageCode), $slug);
}
/**

View file

@ -44,8 +44,9 @@ interface UpdatePageInterface extends BaseUpdatePageInterface
/**
* @param string $slug
* @param string $languageCode
*/
public function specifySlug($slug);
public function specifySlug($slug, $languageCode);
/**
* @return bool

View file

@ -85,3 +85,8 @@ th {
.ui.input input[readonly] {
color: #aaa;
}
.field.loading.transition {
top: auto;
left: auto;
}