[Admin][Payment] Not displaying payments in cart state on the list

This commit is contained in:
Grzegorz Sadowski 2019-08-22 08:12:02 +02:00
parent 2f04aad6f5
commit 9deddd763c
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
5 changed files with 15 additions and 6 deletions

View file

@ -18,6 +18,12 @@ Feature: Browsing payments
Then I should see a single payment in the list
And the payments of the "#00000001" order should be "New" for "amba@fatima.org"
@ui
Scenario: Not seeing payments in cart state
Given the customer added "Apple" product to the cart
When I browse payments
Then I should see a single payment in the list
@ui
Scenario: Payments are sorted by newest as default
Given there is an "#00000002" order with "Apple" product ordered later

View file

@ -229,9 +229,10 @@ final class CartContext implements Context
* @Given /^I (?:add|added) (this product) to the cart$/
* @Given I added product :product to the cart
* @Given /^I (?:have|had) (product "[^"]+") in the cart$/
* @Given the customer added :product product to the cart
* @When I add product :product to the cart
*/
public function iAddProductToTheCart(ProductInterface $product)
public function iAddProductToTheCart(ProductInterface $product): void
{
$this->productShowPage->open(['slug' => $product->getSlug()]);
$this->productShowPage->addToCart();

View file

@ -26,6 +26,6 @@ default:
- sylius.behat.context.ui.channel
- sylius.behat.context.ui.admin.managing_payments
- sylius.behat.context.ui.shop.cart
filters:
tags: "@managing_payments && @ui"

View file

@ -5,6 +5,8 @@ sylius_grid:
name: doctrine/orm
options:
class: "%sylius.model.payment.class%"
repository:
method: createListQueryBuilder
sorting:
createdAt: desc
fields:

View file

@ -20,12 +20,12 @@ use Sylius\Component\Core\Repository\PaymentRepositoryInterface;
class PaymentRepository extends EntityRepository implements PaymentRepositoryInterface
{
/**
* {@inheritdoc}
*/
public function createListQueryBuilder(): QueryBuilder
{
return $this->createQueryBuilder('o');
return $this->createQueryBuilder('o')
->andWhere('o.state != :state')
->setParameter('state', PaymentInterface::STATE_CART)
;
}
/**