Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function testIsGettingWishList(): void
- {
- // Real WishList
- $simpleIphoneSixPlus = new Simple();
- $simpleIphoneSixPlus->setSku('iph0n3-6plus');
- $productIphone = new WishListProduct('iph0n3');
- $productIphone->setSimples([$simpleIphoneSixPlus]);
- $productIphone->setName('iPhone');
- $productIphone->setWishListId(1);
- $productIphone->setWishListPrice(Money::fromCents(110000));
- $productIphone->setAddedOn(new DateTime('2016-04-24 12:00:00'));
- $productIphone->setStock(9);
- $productIphone->setPrice(Money::fromCents(100000));
- $productIphone->setOriginalPrice(Money::fromCents(110000));
- $productIphone->setSlug('iphone');
- $productIphone->activate();
- $simpleMacBookAir = new Simple();
- $simpleMacBookAir->setSku('M4cBo0k-air');
- $productMacBook = new WishListProduct('M4cBo0k');
- $productMacBook->setSimples([$simpleMacBookAir]);
- $productMacBook->setWishListId(2);
- $productMacBook->setName('MacBookPro');
- $productMacBook->setWishListPrice(Money::fromCents(22000));
- $productMacBook->setAddedOn(new DateTime('2016-04-25 12:00:00'));
- $productMacBook->setStock(5);
- $productMacBook->setPrice(Money::fromCents(1000));
- $productMacBook->setOriginalPrice(Money::fromCents(10));
- $productMacBook->setSlug('macbook');
- $productMacBook->activate();
- $owner = new Customer();
- $owner->setId(10);
- $paginationData = [
- 'page' => 1,
- 'pageSize' => 10,
- ];
- $wishList = new WishList('Birthday', $owner);
- $wishList->setId(10);
- $wishList->setVisibility(WishList::VISIBILITY_PRIVATE);
- $wishList->setCreatedAt(new DateTime('2016-04-24 11:00:00'));
- $wishList->setDescription('My birthday greed.');
- $wishList->addProduct($productIphone);
- $wishList->addProduct($productMacBook);
- // Set up test doubles
- $wishListAdapter = $this->prophesize(WishListAdapter::class);
- $wishListAdapter->getWishList($wishList, $paginationData)
- ->shouldBeCalled()
- ->willReturn($wishList);
- $cacheService = $this->prophesize(CacheService::class);
- $productService = $this->prophesize(ProductService::class);
- $productService->getBySkus(['iph0n3', 'M4cBo0k'])
- ->shouldBeCalled()
- ->willReturn([$productIphone, $productMacBook]);
- $service = new ManageWishList($wishListAdapter->reveal(), $cacheService->reveal());
- $service->setProductService($productService->reveal());
- $actual = $service->getWishList($wishList, $paginationData);
- $this->assertEquals($wishList, $actual);
- }
Add Comment
Please, Sign In to add comment