diff --git a/src/Entity/Wishlist.php b/src/Entity/Wishlist.php index 110d4467..c3119cf3 100644 --- a/src/Entity/Wishlist.php +++ b/src/Entity/Wishlist.php @@ -16,9 +16,12 @@ use Sylius\Component\Core\Model\ProductInterface; use Sylius\Component\Core\Model\ProductVariantInterface; use Sylius\Component\Core\Model\ShopUserInterface; +use Sylius\Component\Resource\Model\TimestampableTrait; class Wishlist implements WishlistInterface { + use TimestampableTrait; + protected ?int $id = null; protected ?string $name; @@ -38,6 +41,8 @@ public function __construct() $this->wishlistProducts = new ArrayCollection(); $this->token = new WishlistToken(); $this->id = null; + + $this->createdAt = new \DateTime(); } public function getId(): ?int diff --git a/src/Resources/config/doctrine/Wishlist.orm.xml b/src/Resources/config/doctrine/Wishlist.orm.xml index 646ec2fd..51a51f91 100644 --- a/src/Resources/config/doctrine/Wishlist.orm.xml +++ b/src/Resources/config/doctrine/Wishlist.orm.xml @@ -1,6 +1,7 @@ @@ -30,6 +31,13 @@ + + + + + + + diff --git a/tests/Behat/Context/Api/WishlistContext.php b/tests/Behat/Context/Api/WishlistContext.php index be6347bf..72f8524c 100644 --- a/tests/Behat/Context/Api/WishlistContext.php +++ b/tests/Behat/Context/Api/WishlistContext.php @@ -94,7 +94,6 @@ public function userIsAuthenticated(string $email, string $password): void 'body' => json_encode($body), ] ); - Assert::eq($response->getStatusCode(), 200); $json = json_decode((string) $response->getBody()); @@ -127,7 +126,9 @@ public function userHasAWishlist(): void $this->getOptions(self::POST, []) ); + Assert::eq($response->getStatusCode(), 201); $jsonBody = json_decode((string) $response->getBody()); + var_dump($jsonBody); /** @var WishlistInterface $wishlist */ $wishlist = $this->wishlistRepository->find((int) $jsonBody->id);