Skip to content

Commit be4dc0a

Browse files
committed
OP-291: Cover edge case with behat tests
1 parent 9beaad4 commit be4dc0a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

features/removing_guest_wishlists.feature

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ Feature: Removing guest wishlists
2222

2323
@cli
2424
Scenario: Removing guest wishlists with date
25-
Given there is a guest wishlist which has been inactive for a week
26-
And there are 2 wishlists in the database
25+
Given there is a guest wishlist which has been inactive for 5 days
26+
And there is a guest wishlist which has been inactive for 4 days
27+
And there are 3 wishlists in the database
2728
When I run delete guests wishlists command to delete wishlists inactive for more than 5 days
2829
Then the command should succeed
29-
And there is 1 wishlist in the database
30+
And there are 2 wishlists in the database
3031

3132
@cli
3233
Scenario: Removing guest wishlists with invalid date

tests/Behat/Context/Setup/WishlistContext.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,15 @@ public function userHasAWishlist(string $email): void
159159
}
160160

161161
/**
162-
* @When there is a guest wishlist which has been inactive for a week
162+
* @When there is a guest wishlist which has been inactive for :days days
163163
*/
164-
public function thereIsAGuestWishlistInactiveForAWeek(): void
164+
public function thereIsAGuestWishlistInactiveForDays(int $days): void
165165
{
166166
$wishlist = new Wishlist();
167167
$channel = $this->channelRepository->findOneByCode('WEB-US');
168168

169169
$updatedAt = new \DateTime();
170-
$updatedAt->modify('-7 days');
170+
$updatedAt->modify(\sprintf('-%d days', $days));
171171

172172
$wishlist->setChannel($channel);
173173
$wishlist->setUpdatedAt($updatedAt);

0 commit comments

Comments
 (0)