mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[Behat] Fix failing scenarios that was hidden behind fatal error
This commit is contained in:
parent
41051b0130
commit
64ef1e9c58
12 changed files with 43 additions and 42 deletions
|
|
@ -5,7 +5,8 @@ Feature: Adding a new taxon
|
|||
I want to add a new taxon to the registry
|
||||
|
||||
Background:
|
||||
Given I am logged in as an administrator
|
||||
Given the store operates on a single channel in "France"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Adding a new taxon
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ Feature: Deleting a taxon
|
|||
I want to be able to delete a taxon
|
||||
|
||||
Background:
|
||||
Given I am logged in as an administrator
|
||||
Given the store operates on a single channel in "France"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
Scenario: Deleted taxon should disappear from the registry
|
||||
|
|
|
|||
|
|
@ -42,9 +42,12 @@ final class TaxonContext implements Context
|
|||
* @Transform /^parent taxon to "([^"]+)"$/
|
||||
* @Transform /^taxon with "([^"]+)" name/
|
||||
*/
|
||||
public function getTaxonByName($taxonName)
|
||||
public function getTaxonByName($name)
|
||||
{
|
||||
return $this->getTaxonBy(['name' => $taxonName]);
|
||||
$taxon = $this->taxonRepository->findOneByName($name);
|
||||
Assert::notNull($taxon, sprintf('Taxon with name "%s" does not exist.', $name));
|
||||
|
||||
return $taxon;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +55,10 @@ final class TaxonContext implements Context
|
|||
*/
|
||||
public function getTaxonByCode($code)
|
||||
{
|
||||
return $this->getTaxonBy(['code' => $code]);
|
||||
$taxon = $this->taxonRepository->findOneBy(['code' => $code]);
|
||||
Assert::notNull($taxon, sprintf('Taxon with code "%s" does not exist.', $code));
|
||||
|
||||
return $taxon;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -66,16 +72,5 @@ final class TaxonContext implements Context
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
private function getTaxonBy(array $parameters)
|
||||
{
|
||||
$taxon = $this->taxonRepository->findOneBy($parameters);
|
||||
Assert::notNull($taxon, 'Taxon does not exist.');
|
||||
|
||||
return $taxon;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
{
|
||||
return [
|
||||
'starts_at' => '#sylius_promotion_startsAt',
|
||||
'ends_at' => '#sylius_promotion_endsAt',
|
||||
'actions' => '#sylius_promotion_actions',
|
||||
'code' => '#sylius_promotion_code',
|
||||
'name' => '#sylius_promotion_name',
|
||||
|
|
|
|||
|
|
@ -123,6 +123,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
|||
'starts_at' => '#sylius_promotion_startsAt',
|
||||
'starts_at_date' => '#sylius_promotion_startsAt_date',
|
||||
'starts_at_time' => '#sylius_promotion_startsAt_time',
|
||||
'ends_at' => '#sylius_promotion_endsAt',
|
||||
'ends_at_date' => '#sylius_promotion_endsAt_date',
|
||||
'ends_at_time' => '#sylius_promotion_endsAt_time',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
|||
$leafs = $this->getLeafs();
|
||||
foreach ($leafs as $leaf) {
|
||||
if ($leaf->getText() === $name) {
|
||||
$leaf->pressButton('Delete');
|
||||
$leaf->getParent()->pressButton('Delete');
|
||||
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,25 @@ sylius_admin_taxon:
|
|||
resource: |
|
||||
alias: sylius.taxon
|
||||
section: admin
|
||||
templates: SyliusAdminBundle:Crud
|
||||
only: ['update', 'delete']
|
||||
templates: SyliusAdminBundle:Taxon
|
||||
except: ['show', 'index']
|
||||
redirect: update
|
||||
vars:
|
||||
all:
|
||||
subheader: sylius.ui.manage_categorization_of_your_products
|
||||
templates:
|
||||
form: SyliusAdminBundle:Taxon:_form.html.twig
|
||||
subheader: sylius.ui.manage_taxons
|
||||
icon: folder
|
||||
type: sylius.resource
|
||||
|
||||
sylius_admin_taxon_index:
|
||||
path: /taxons/
|
||||
defaults:
|
||||
_controller: FrameworkBundle:Redirect:redirect
|
||||
route: sylius_admin_taxon_create
|
||||
permanent: true
|
||||
|
||||
sylius_admin_taxon_tree:
|
||||
path: /taxons/tree
|
||||
methods: [GET]
|
||||
defaults:
|
||||
_controller: sylius.controller.taxon:indexAction
|
||||
|
|
@ -23,18 +29,3 @@ sylius_admin_taxon_index:
|
|||
repository:
|
||||
method: findRootNodes
|
||||
host: "localhost"
|
||||
|
||||
sylius_admin_taxon_create:
|
||||
path: /taxons/new
|
||||
methods: [GET, POST]
|
||||
defaults:
|
||||
_controller: sylius.controller.taxon:createAction
|
||||
_sylius:
|
||||
template: SyliusAdminBundle:Taxon:create.html.twig
|
||||
section: admin
|
||||
redirect:
|
||||
route: sylius_admin_taxon_update
|
||||
parameters: { id: resource.id }
|
||||
vars:
|
||||
templates:
|
||||
form: SyliusAdminBundle:Taxon:_form.html.twig
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{% block content %}
|
||||
<div class="ui two column grid">
|
||||
<div class="four wide column">
|
||||
{{ render(path('sylius_admin_taxon_index')) }}
|
||||
{{ render(path('sylius_admin_taxon_tree')) }}
|
||||
</div>
|
||||
<div class="twelve wide column">
|
||||
{{ parent() }}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
{% extends 'SyliusAdminBundle:Crud:update.html.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="ui two column stackable grid">
|
||||
<div class="four wide column">
|
||||
{{ render(path('sylius_admin_taxon_tree')) }}
|
||||
</div>
|
||||
<div class="twelve wide column">
|
||||
{{ parent() }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<option name="groups">sylius</option>
|
||||
</constraint>
|
||||
<constraint name="Sylius\Bundle\PromotionBundle\Validator\Constraints\PromotionDateRange">
|
||||
<option name="message">sylius.promotion.startsAt.end_date_cannot_be_set_prior_start_date</option>
|
||||
<option name="message">sylius.promotion.end_date_cannot_be_set_prior_start_date</option>
|
||||
<option name="groups">sylius</option>
|
||||
</constraint>
|
||||
<property name="code">
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ sylius:
|
|||
max_length: Promotion name must not be longer than 1 character.|Promotion name must not be longer than {{ limit }} characters.
|
||||
min_length: Promotion name must be at least 1 character long.|Promotion name must be at least {{ limit }} characters long.
|
||||
not_blank: Please enter promotion name.
|
||||
endsAt:
|
||||
end_date_cannot_be_set_prior_start_date: End date cannot be set prior start date.
|
||||
end_date_cannot_be_set_prior_start_date: End date cannot be set prior start date.
|
||||
promotion_coupon:
|
||||
code:
|
||||
max_length: Coupon code must not be longer than 1 character.|Coupon code must not be longer than {{ limit }} characters.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use Symfony\Component\Validator\Constraint;
|
|||
*/
|
||||
class PromotionDateRange extends Constraint
|
||||
{
|
||||
public $message = 'sylius.promotion.startsAt.end_date_cannot_be_set_prior_start_date';
|
||||
public $message = 'sylius.promotion.end_date_cannot_be_set_prior_start_date';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue