/** * Verify item product data. * * @param InjectableFixture $product * @param int|null $expectedQty * @return void */ protected function verifyItemProduct(InjectableFixture $product, $expectedQty) { \PHPUnit_Framework_Assert::assertTrue($this->wishlistIndex->getItemsBlock()->getItemProductBlock($product)->isVisible(), 'Product "' . $product->getName() . '" in custom wishlist doesn\'t visible.'); if ($expectedQty !== null) { \PHPUnit_Framework_Assert::assertEquals($expectedQty, $this->wishlistIndex->getItemsBlock()->getItemProductBlock($product)->getData()['qty'], 'Actual quantity of "' . $product->getName() . '" in custom wishlist doesn\'t match to expected.'); } }
/** * Assert that product is not present in Wishlist on frontend. * * @param WishlistIndex $wishlistIndex * @param CmsIndex $cmsIndex * @param Customer $customer * @param FrontendActionsForCustomer $frontendActionsForCustomer * @param InjectableFixture[] $products * @return void */ public function processAssert(WishlistIndex $wishlistIndex, CmsIndex $cmsIndex, Customer $customer, FrontendActionsForCustomer $frontendActionsForCustomer, array $products) { $frontendActionsForCustomer->loginCustomer($customer); $cmsIndex->getTopLinksBlock()->openAccountLink("My Wishlist"); $itemBlock = $wishlistIndex->getItemsBlock(); foreach ($products as $itemProduct) { \PHPUnit_Framework_Assert::assertFalse($itemBlock->getItemProductBlock($itemProduct)->isVisible(), "Product '{$itemProduct->getName()}' is present in Wishlist on frontend."); } }
/** * Assert that the correct option details are displayed on the "View Details" tool tip. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture $product * @param FixtureFactory $fixtureFactory * @return void */ public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex, InjectableFixture $product, FixtureFactory $fixtureFactory) { $cmsIndex->getTopLinksBlock()->openAccount(); $cmsIndex->getLinksBlock()->openLink("My Wishlist"); $actualOptions = $wishlistIndex->getItemsBlock()->getItemProductBlock($product)->getOptions(); $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); $expectedOptions = $this->prepareOptions($cartFixture); $errors = $this->verifyData($expectedOptions, $this->sortDataByPath($actualOptions, '::title')); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Assert that product is present in default wishlist. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex * @param InjectableFixture $product * @return void */ public function processAssert(CmsIndex $cmsIndex, WishlistIndex $wishlistIndex, InjectableFixture $product) { $cmsIndex->getTopLinksBlock()->openAccount(); $cmsIndex->getLinksBlock()->openLink("My Wishlist"); \PHPUnit_Framework_Assert::assertTrue($wishlistIndex->getItemsBlock()->getItemProductBlock($product)->isVisible(), $product->getName() . ' is not visible on wishlist page.'); }