mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +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
|
I want to add a new taxon to the registry
|
||||||
|
|
||||||
Background:
|
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
|
@ui
|
||||||
Scenario: Adding a new taxon
|
Scenario: Adding a new taxon
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ Feature: Deleting a taxon
|
||||||
I want to be able to delete a taxon
|
I want to be able to delete a taxon
|
||||||
|
|
||||||
Background:
|
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
|
@ui
|
||||||
Scenario: Deleted taxon should disappear from the registry
|
Scenario: Deleted taxon should disappear from the registry
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,12 @@ final class TaxonContext implements Context
|
||||||
* @Transform /^parent taxon to "([^"]+)"$/
|
* @Transform /^parent taxon to "([^"]+)"$/
|
||||||
* @Transform /^taxon with "([^"]+)" name/
|
* @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)
|
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 [
|
return [
|
||||||
'starts_at' => '#sylius_promotion_startsAt',
|
'starts_at' => '#sylius_promotion_startsAt',
|
||||||
|
'ends_at' => '#sylius_promotion_endsAt',
|
||||||
'actions' => '#sylius_promotion_actions',
|
'actions' => '#sylius_promotion_actions',
|
||||||
'code' => '#sylius_promotion_code',
|
'code' => '#sylius_promotion_code',
|
||||||
'name' => '#sylius_promotion_name',
|
'name' => '#sylius_promotion_name',
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
|
||||||
'starts_at' => '#sylius_promotion_startsAt',
|
'starts_at' => '#sylius_promotion_startsAt',
|
||||||
'starts_at_date' => '#sylius_promotion_startsAt_date',
|
'starts_at_date' => '#sylius_promotion_startsAt_date',
|
||||||
'starts_at_time' => '#sylius_promotion_startsAt_time',
|
'starts_at_time' => '#sylius_promotion_startsAt_time',
|
||||||
|
'ends_at' => '#sylius_promotion_endsAt',
|
||||||
'ends_at_date' => '#sylius_promotion_endsAt_date',
|
'ends_at_date' => '#sylius_promotion_endsAt_date',
|
||||||
'ends_at_time' => '#sylius_promotion_endsAt_time',
|
'ends_at_time' => '#sylius_promotion_endsAt_time',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface
|
||||||
$leafs = $this->getLeafs();
|
$leafs = $this->getLeafs();
|
||||||
foreach ($leafs as $leaf) {
|
foreach ($leafs as $leaf) {
|
||||||
if ($leaf->getText() === $name) {
|
if ($leaf->getText() === $name) {
|
||||||
$leaf->pressButton('Delete');
|
$leaf->getParent()->pressButton('Delete');
|
||||||
|
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,25 @@ sylius_admin_taxon:
|
||||||
resource: |
|
resource: |
|
||||||
alias: sylius.taxon
|
alias: sylius.taxon
|
||||||
section: admin
|
section: admin
|
||||||
templates: SyliusAdminBundle:Crud
|
templates: SyliusAdminBundle:Taxon
|
||||||
only: ['update', 'delete']
|
except: ['show', 'index']
|
||||||
redirect: update
|
redirect: update
|
||||||
vars:
|
vars:
|
||||||
all:
|
all:
|
||||||
|
subheader: sylius.ui.manage_categorization_of_your_products
|
||||||
templates:
|
templates:
|
||||||
form: SyliusAdminBundle:Taxon:_form.html.twig
|
form: SyliusAdminBundle:Taxon:_form.html.twig
|
||||||
subheader: sylius.ui.manage_taxons
|
|
||||||
icon: folder
|
|
||||||
type: sylius.resource
|
type: sylius.resource
|
||||||
|
|
||||||
sylius_admin_taxon_index:
|
sylius_admin_taxon_index:
|
||||||
path: /taxons/
|
path: /taxons/
|
||||||
|
defaults:
|
||||||
|
_controller: FrameworkBundle:Redirect:redirect
|
||||||
|
route: sylius_admin_taxon_create
|
||||||
|
permanent: true
|
||||||
|
|
||||||
|
sylius_admin_taxon_tree:
|
||||||
|
path: /taxons/tree
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
defaults:
|
defaults:
|
||||||
_controller: sylius.controller.taxon:indexAction
|
_controller: sylius.controller.taxon:indexAction
|
||||||
|
|
@ -23,18 +29,3 @@ sylius_admin_taxon_index:
|
||||||
repository:
|
repository:
|
||||||
method: findRootNodes
|
method: findRootNodes
|
||||||
host: "localhost"
|
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 %}
|
{% block content %}
|
||||||
<div class="ui two column grid">
|
<div class="ui two column grid">
|
||||||
<div class="four wide column">
|
<div class="four wide column">
|
||||||
{{ render(path('sylius_admin_taxon_index')) }}
|
{{ render(path('sylius_admin_taxon_tree')) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="twelve wide column">
|
<div class="twelve wide column">
|
||||||
{{ parent() }}
|
{{ 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>
|
<option name="groups">sylius</option>
|
||||||
</constraint>
|
</constraint>
|
||||||
<constraint name="Sylius\Bundle\PromotionBundle\Validator\Constraints\PromotionDateRange">
|
<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>
|
<option name="groups">sylius</option>
|
||||||
</constraint>
|
</constraint>
|
||||||
<property name="code">
|
<property name="code">
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ sylius:
|
||||||
max_length: Promotion name must not be longer than 1 character.|Promotion name must not be longer than {{ limit }} characters.
|
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.
|
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.
|
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:
|
promotion_coupon:
|
||||||
code:
|
code:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use Symfony\Component\Validator\Constraint;
|
||||||
*/
|
*/
|
||||||
class PromotionDateRange extends 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}
|
* {@inheritdoc}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue