Skip to content

Commit

Permalink
applied Grzegorz's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
clem21 committed Jan 11, 2021
1 parent 8666f26 commit c3a01cd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
7 changes: 7 additions & 0 deletions features/seeing_refund_payments_on_admin_order_view.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ Feature: Seeing refund payments on admin order view
Scenario: Seeing refund payment on order view
When I view the summary of the order "#00000022"
Then I should see 1 refund payment with status "New"

@ui
Scenario: Having all credit memos listed on the order page in ascending order
Given the "#00000022" order's shipping cost already has a refund of "$2.50" with "Space money" payment
When I view the summary of the order "#00000022"
Then I should see the credit memo with "$10.00" total as 1st in the list
And I should see the credit memo with "$2.50" total as 2nd in the list
8 changes: 0 additions & 8 deletions features/viewing_details_of_credit_memo.feature
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,3 @@ Feature: Viewing details of a credit memo
And it should contain 1 "Galaxy Post" shipment with "4.50" gross value in "USD" currency
And it should be issued in "United States" channel
And its total should be "4.50" in "USD" currency

@ui
Scenario: Having all credit memos listed on the order page in ascending order
Given the "#00000022" order's shipping cost already has a refund of "$4.50" with "Space money" payment
And the 1st "PHP T-Shirt" product from order "#00000022" has a refund of "$5.50" with "Space money" payment
When I view the summary of the order "#00000022"
Then I should see "4.50" credit memo as 1st in the list
And I should see "5.50" credit memo as 2nd in the list
6 changes: 3 additions & 3 deletions src/Doctrine/ORM/CreditMemoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class CreditMemoRepository extends EntityRepository implements CreditMemoReposit
{
public function findByOrderId(string $orderId): array
{
return $this->createQueryBuilder('c')
->andWhere('c.order = :orderId')
->addOrderBy('c.issuedAt', 'ASC')
return $this->createQueryBuilder('o')
->andWhere('o.order = :orderId')
->addOrderBy('o.issuedAt', 'ASC')
->setParameter('orderId', $orderId)
->getQuery()
->getResult()
Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/Context/Ui/CreditMemoContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ public function pdfFileShouldBeSuccessfullyDownloaded(): void
}

/**
* @Then /^I should see "([^"]+)" credit memo as (\d+)(?:|st|nd|rd|th) in the list$/
* @Then /^I should see the credit memo with "([^"]+)" total as (\d+)(?:|st|nd|rd|th) in the list$/
*/
public function iShouldCreditMemoOrderByAscInTheList(string $creditMemo, int $position): void
public function iShouldCreditMemoOrderByAscInTheList(string $creditMemoTotal, int $position): void
{
Assert::true($this->creditMemoDetailsPage->isCreditMemoInPosition($creditMemo, $position));
Assert::true($this->creditMemoDetailsPage->isCreditMemoInPosition($creditMemoTotal, $position));
}
}
2 changes: 1 addition & 1 deletion tests/Behat/Page/Admin/CreditMemoDetailsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ public function isCreditMemoInPosition(string $creditMemo, int $position): bool
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
'credit_memo_in_given_position' => 'table tbody tr:nth-child(%position%) td:contains("%creditMemo%")',
'table' => 'table',
'tax_item_amount' => 'tr.tax-item:contains("%label%") .tax-item-amount',
'total' => '#credit-memo-total',
'total_currency_code' => '#credit-memo-total-currency-code',
'credit_memo_in_given_position' => 'table tbody tr:nth-child(%position%) td:contains("%creditMemo%")',
]);
}
}

0 comments on commit c3a01cd

Please sign in to comment.