mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Refactoring
This commit is contained in:
parent
27df7f121d
commit
335f678eaf
8 changed files with 109 additions and 58 deletions
|
|
@ -143,6 +143,24 @@ This filter checks if the specified field contains any value
|
|||
options:
|
||||
field: completedAt
|
||||
|
||||
Select
|
||||
------
|
||||
|
||||
This type filters by a value chosen from the defined list
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
sylius_grid:
|
||||
grids:
|
||||
app_order:
|
||||
filters:
|
||||
state:
|
||||
type: select
|
||||
form_options:
|
||||
choices:
|
||||
sylius.ui.ready: Ready
|
||||
sylius.ui.shipped: Shipped
|
||||
|
||||
Custom Filters
|
||||
--------------
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
@managing_shipments
|
||||
Feature: Filtering shipments from multiple channels by state
|
||||
In order to filtering shipments by state
|
||||
Feature: Filtering shipments by state
|
||||
In order to filter shipments by state
|
||||
As an Administrator
|
||||
I want to browse all shipments with choosen state
|
||||
|
||||
|
|
@ -14,17 +14,10 @@ Feature: Filtering shipments from multiple channels by state
|
|||
And the customer "Donald Duck" addressed it to "Elm street", "90802" "Duckburg" in the "United States" with identical billing address
|
||||
And the customer chose "UPS" shipping method with "Cash on Delivery" payment
|
||||
And this order has already been shipped
|
||||
And the store has country "Canada"
|
||||
And the store operates on another channel named "Canada" in "CAD" currency
|
||||
And the store has a zone "Canada" with code "CA"
|
||||
And this zone has the "Canada" country member
|
||||
And the store has "FEDEX" shipping method with "$10.00" fee
|
||||
And the store allows paying with "Bank transfer"
|
||||
And the store has a product "Orange"
|
||||
And there is a customer "iron@man.com" that placed an order "#00000003" in channel "canada"
|
||||
And the customer bought a single "Orange"
|
||||
And the customer "Tony Stark" addressed it to "Rich street", "90802" "New York" in the "Canada" with identical billing address
|
||||
And the customer chose "FEDEX" shipping method with "bank transfer" payment
|
||||
And there is a customer "iron@man.com" that placed an order "#00000003" in channel "united states"
|
||||
And the customer bought a single "Apple"
|
||||
And the customer "Tony Stark" addressed it to "Rich street", "90802" "New York" in the "United States" with identical billing address
|
||||
And the customer chose "UPS" shipping method with "Cash on Delivery" payment
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui
|
||||
|
|
@ -32,9 +25,6 @@ Feature: Filtering shipments from multiple channels by state
|
|||
When I browse shipments
|
||||
And I choose "Shipped" as a shipment state
|
||||
And I filter
|
||||
Then I should see 1 shipments in the list
|
||||
And I should see an shipment with "#00000001" order number
|
||||
But I should not see an shipment with "#00000003" order number
|
||||
|
||||
|
||||
|
||||
Then I should see a single shipment in the list
|
||||
And I should see a shipment of order "#00000001"
|
||||
But I should not see a shipment of order "#00000003"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Behat\Context\Ui\Admin;
|
||||
|
|
@ -52,42 +61,43 @@ final class ManagingShipmentsContext implements Context
|
|||
}
|
||||
|
||||
/**
|
||||
* @Then I should see :count shipments in the list
|
||||
* @When I choose :shipmentState as a shipment state
|
||||
*/
|
||||
public function iShouldSeeCountShipmentsInList(int $count): void
|
||||
public function iChooseShipmentState(string $shipmentState): void
|
||||
{
|
||||
Assert::same($count, $this->indexPage->countItems());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I choose :shipmentState as a shipment state
|
||||
*/
|
||||
public function iChooseAsAShipmentState(string $shipmentState): void
|
||||
{
|
||||
$this->indexPage->chooseShipmentFilter($shipmentState);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I should see an shipment with :orderNumber order number
|
||||
*/
|
||||
public function iShouldSeeAnShipmentWithOrderNumber(string $orderNumber): void
|
||||
{
|
||||
Assert::true($this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given I should not see an shipment with :orderNumber order number
|
||||
*/
|
||||
public function iShouldNotSeeAnShipmentWithOrderNumber(string $orderNumber): void
|
||||
{
|
||||
Assert::false($this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]));
|
||||
$this->indexPage->chooseStateToFilter($shipmentState);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I filter
|
||||
*/
|
||||
public function iFilter()
|
||||
public function iFilter(): void
|
||||
{
|
||||
$this->indexPage->filter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see :count shipment(s) in the list
|
||||
* @Then I should see a single shipment in the list
|
||||
*/
|
||||
public function iShouldSeeCountShipmentsInList(int $count = 1): void
|
||||
{
|
||||
Assert::same($count, $this->indexPage->countItems());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see a shipment of order :orderNumber
|
||||
*/
|
||||
public function iShouldSeeShipmentWithOrderNumber(string $orderNumber): void
|
||||
{
|
||||
Assert::true($this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should not see a shipment of order :orderNumber
|
||||
*/
|
||||
public function iShouldNotSeeShipmentWithOrderNumber(string $orderNumber): void
|
||||
{
|
||||
Assert::false($this->indexPage->isSingleResourceOnPage(['number' => $orderNumber]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,23 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Behat\Page\Admin\Shipment;
|
||||
|
||||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||
|
||||
final class IndexPage extends BaseIndexPage implements IndexPageInterface
|
||||
class IndexPage extends BaseIndexPage implements IndexPageInterface
|
||||
{
|
||||
public function chooseShipmentFilter(string $shipmentState): void
|
||||
public function chooseStateToFilter(string $shipmentState): void
|
||||
{
|
||||
$this->getElement('filter_state')->selectOption($shipmentState);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Behat\Page\Admin\Shipment;
|
||||
|
|
@ -8,5 +17,5 @@ use Sylius\Behat\Page\Admin\Crud\IndexPageInterface as BaseIndexPageInterface;
|
|||
|
||||
interface IndexPageInterface extends BaseIndexPageInterface
|
||||
{
|
||||
public function chooseShipmentFilter(string $shipmentState): void;
|
||||
public function chooseStateToFilter(string $shipmentState): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ sylius_grid:
|
|||
update_product_positions: "@SyliusAdmin/Product/Grid/Action/updatePositions.html.twig"
|
||||
update_product_variant_positions: "@SyliusAdmin/ProductVariant/Grid/Action/updatePositions.html.twig"
|
||||
filter:
|
||||
string: "@SyliusUi/Grid/Filter/string.html.twig"
|
||||
boolean: "@SyliusUi/Grid/Filter/boolean.html.twig"
|
||||
date: "@SyliusUi/Grid/Filter/date.html.twig"
|
||||
entity: "@SyliusUi/Grid/Filter/entity.html.twig"
|
||||
money: "@SyliusUi/Grid/Filter/money.html.twig"
|
||||
exists: "@SyliusUi/Grid/Filter/exists.html.twig"
|
||||
money: "@SyliusUi/Grid/Filter/money.html.twig"
|
||||
select: "@SyliusUi/Grid/Filter/select.html.twig"
|
||||
string: "@SyliusUi/Grid/Filter/string.html.twig"
|
||||
bulk_action:
|
||||
delete: "@SyliusUi/Grid/BulkAction/delete.html.twig"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Bundle\GridBundle\Form\Type\Filter;
|
||||
|
|
@ -10,23 +19,20 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
final class SelectFilterType extends AbstractType
|
||||
{
|
||||
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver
|
||||
->setDefault('placeholder', 'sylius.ui.all')
|
||||
->setAllowedTypes('choices', ['array']
|
||||
)
|
||||
->setAllowedTypes('choices', ['array'])
|
||||
;
|
||||
}
|
||||
|
||||
public function getParent(): string
|
||||
public function getParent(): string
|
||||
{
|
||||
return ChoiceType::class;
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
public function getBlockPrefix():string
|
||||
{
|
||||
return 'sylius_grid_filter_select';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Component\Grid\Filter;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue