Skip to content

Commit

Permalink
OP-291: Cover edge case with behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hmfilar committed Jul 30, 2024
1 parent 9beaad4 commit be4dc0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions features/removing_guest_wishlists.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ Feature: Removing guest wishlists

@cli
Scenario: Removing guest wishlists with date
Given there is a guest wishlist which has been inactive for a week
And there are 2 wishlists in the database
Given there is a guest wishlist which has been inactive for 5 days
And there is a guest wishlist which has been inactive for 4 days
And there are 3 wishlists in the database
When I run delete guests wishlists command to delete wishlists inactive for more than 5 days
Then the command should succeed
And there is 1 wishlist in the database
And there are 2 wishlists in the database

@cli
Scenario: Removing guest wishlists with invalid date
Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/Context/Setup/WishlistContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ public function userHasAWishlist(string $email): void
}

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

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

$wishlist->setChannel($channel);
$wishlist->setUpdatedAt($updatedAt);
Expand Down

0 comments on commit be4dc0a

Please sign in to comment.