当前位置: 首页>>代码示例>>PHP>>正文


PHP Fixture\CatalogCategory类代码示例

本文整理汇总了PHP中Mage\Catalog\Test\Fixture\CatalogCategory的典型用法代码示例。如果您正苦于以下问题:PHP CatalogCategory类的具体用法?PHP CatalogCategory怎么用?PHP CatalogCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CatalogCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAssert

 /**
  * Assert that products' MAP has been applied before checkout.
  *
  * @param CatalogCategory $category
  * @param Customer $customer
  * @param Address $address
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $cart
  * @param CheckoutOnepage $checkoutOnePage
  * @param array $products
  * @return void
  */
 public function processAssert(CatalogCategory $category, Customer $customer, Address $address, CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogProductView $catalogProductView, CheckoutCart $cart, CheckoutOnepage $checkoutOnePage, array $products)
 {
     for ($i = 0; $i < count($products); $i++) {
         $cart->getCartBlock()->clearShoppingCart();
         $productName = $products[$i]->getName();
         $cmsIndex->open();
         $cmsIndex->getTopmenu()->selectCategory($category->getName());
         // Check that price is not present on category page.
         $listProductBlock = $catalogCategoryView->getListProductBlock();
         $productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
         $productPriceBlock->clickForPrice();
         \PHPUnit_Framework_Assert::assertFalse($productPriceBlock->getMapBlock()->isPriceVisible(), 'Price is present in MSRP dialog on category page.');
         // Check that price is not present on product page.
         $listProductBlock->openProductViewPage($productName);
         \PHPUnit_Framework_Assert::assertFalse($catalogProductView->getViewBlock()->getPriceBlock()->isRegularPriceVisible(), 'Price is present in View block on product page.');
         // Check that price is not present on cart.
         $catalogProductView->getViewBlock()->addToCart($products[$i]);
         \PHPUnit_Framework_Assert::assertTrue($cart->getCartBlock()->getCartItem($products[$i])->isMsrpVisible(), "MSRP link is not visible in cart.");
         // Check that price is present on review block in onepage checkout page.
         $cart->getCartBlock()->getProceedToCheckoutBlock()->proceedToCheckout();
         $checkoutMethodBlock = $checkoutOnePage->getLoginBlock();
         $billingBlock = $checkoutOnePage->getBillingBlock();
         $paymentMethodBlock = $checkoutOnePage->getPaymentMethodsBlock();
         $shippingBlock = $checkoutOnePage->getShippingMethodBlock();
         $checkoutMethodBlock->guestCheckout();
         $checkoutMethodBlock->clickContinue();
         $billingBlock->fillBilling($address, $customer);
         $billingBlock->clickContinue();
         $shippingBlock->selectShippingMethod(['shipping_service' => 'Flat Rate', 'shipping_method' => 'Fixed']);
         $shippingBlock->clickContinue();
         $paymentMethodBlock->selectPaymentMethod(['method' => 'checkmo']);
         $paymentMethodBlock->clickContinue();
         \PHPUnit_Framework_Assert::assertEquals(number_format($products[$i]->getPrice(), 2), $checkoutOnePage->getReviewBlock()->getTotalBlock()->getData('subtotal'), "Subtotal in checkout one page for {$productName} is not equal to expected.");
     }
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:49,代码来源:AssertProductMapAppliedBeforeCheckout.php

示例2: processAssert

 /**
  * Assert that apache redirect works by opening category page and asserting index.php in its url.
  *
  * @param CatalogCategory $category
  * @param CmsIndex $homePage
  * @param BrowserInterface $browser
  */
 public function processAssert(CatalogCategory $category, CmsIndex $homePage, BrowserInterface $browser)
 {
     $category->persist();
     $homePage->open();
     $homePage->getTopmenu()->selectCategory($category->getName());
     \PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'index.php') === false, 'Apache redirect for category does not work.');
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:14,代码来源:AssertRewritesEnabled.php

示例3: processAssert

 /**
  * Assert that Wishlist can't be find by another Customer (or guest) via "Wishlist Search".
  *
  * @param CustomerAccountLogout $customerAccountLogout
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param SearchResult $searchResult
  * @param CatalogCategory $category
  * @param Customer $customer
  * @param Wishlist $wishlist
  * @return void
  */
 public function processAssert(CustomerAccountLogout $customerAccountLogout, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, SearchResult $searchResult, CatalogCategory $category, Customer $customer, Wishlist $wishlist)
 {
     $customerAccountLogout->open();
     $cmsIndex->open()->getTopmenu()->selectCategory($category->getName());
     $catalogCategoryView->getWishlistSearchBlock()->searchByCustomer($customer);
     \PHPUnit_Framework_Assert::assertFalse($searchResult->getWishlistSearchResultBlock()->isWishlistVisibleInGrid($wishlist), "Multiple wishlist is visible on wishlist search result page.");
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:19,代码来源:AssertMultipleWishlistIsPrivate.php

示例4: processAssert

 /**
  * Assert that filtered product is present on category page by attribute and another products are absent.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param ProcessList $processList
  * @param Browser $browser
  * @param CatalogCategory $category
  * @param InjectableFixture[] $products
  * @param string $searchProductsIndexes
  * @param string $filterLink
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, ProcessList $processList, Browser $browser, CatalogCategory $category, array $products, $searchProductsIndexes, $filterLink)
 {
     $processList->open()->getIndexManagementGrid()->massactionForAll('Reindex Data');
     $browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
     $filter = $this->prepareFilter($products[$searchProductsIndexes], $filterLink);
     $catalogCategoryView->getLayeredNavigationBlock()->selectAttribute($filter);
     $this->verify($catalogCategoryView, $products, $searchProductsIndexes);
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:20,代码来源:AssertProductsVisibleOnCategoryPageShopByAttribute.php

示例5: processAssert

 /**
  * Assert that displayed assigned products on category page equals passed from fixture.
  *
  * @param CatalogCategory $category
  * @param CatalogCategoryView $categoryView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategoryView $categoryView, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
     $products = $category->getDataFieldConfig('category_products')['source']->getProducts();
     foreach ($products as $productFixture) {
         \PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($productFixture), "Products '{$productFixture->getName()}' is not find.");
     }
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:16,代码来源:AssertCategoryForAssignedProducts.php

示例6: test

 /**
  * Delete category.
  *
  * @param CatalogCategory $category
  * @return void
  */
 public function test(CatalogCategory $category)
 {
     // Preconditions:
     $category->persist();
     // Steps:
     $this->catalogCategoryIndex->open();
     $this->catalogCategoryIndex->getTreeCategories()->selectCategory($category);
     $this->catalogCategoryIndex->getFormPageActions()->deleteAndAcceptAlert();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:15,代码来源:DeleteCategoryEntityTest.php

示例7: processAssert

 /**
  * Assert that displayed category data on edit page(backend) equals passed from fixture.
  *
  * @param CatalogCategory $category
  * @param CatalogCategoryIndex $catalogCategoryIndex
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategoryIndex $catalogCategoryIndex)
 {
     $data = $category->getData();
     $catalogCategoryIndex->open();
     $catalogCategoryIndex->getTreeCategories()->selectCategory($category);
     $dataForm = $catalogCategoryIndex->getCategoryForm()->getDataCategory($category);
     $error = $this->verifyData($data, $dataForm);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:16,代码来源:AssertCategoryForm.php

示例8: processAssert

 /**
  * Assert that product is absent in the category page.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertFalse($isProductVisible, 'Product is present on category page.');
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:19,代码来源:AssertProductOutOfStockOnCategory.php

示例9: processAssert

 /**
  * Assert that sitemap.xml file contains correct content according to dataset:
  *  - product url
  *  - category url
  *  - CMS page url
  *
  * @param CatalogProductSimple $product
  * @param CatalogCategory $category
  * @param CmsPage $cmsPage
  * @param Sitemap $sitemap
  * @param SitemapIndex $sitemapIndex
  * @return void
  */
 public function processAssert(CatalogProductSimple $product, CatalogCategory $category, CmsPage $cmsPage, Sitemap $sitemap, SitemapIndex $sitemapIndex)
 {
     $sitemapIndex->open()->getSitemapGrid()->sortGridByField('sitemap_id');
     $filter = ['sitemap_filename' => $sitemap->getSitemapFilename(), 'sitemap_path' => $sitemap->getSitemapPath()];
     $sitemapIndex->getSitemapGrid()->search($filter);
     $content = file_get_contents($sitemapIndex->getSitemapGrid()->getLinkForGoogle());
     $frontendUrl = str_replace('index.php/', '', $_ENV['app_frontend_url']);
     $urls = [$frontendUrl . $product->getUrlKey() . '.html', $frontendUrl . $category->getUrlKey() . '.html', $frontendUrl . $cmsPage->getIdentifier()];
     \PHPUnit_Framework_Assert::assertTrue($this->checkContent($content, $urls), "File '{$sitemap->getSitemapFilename()}' does not contains correct content.");
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:23,代码来源:AssertSitemapContent.php

示例10: processAssert

 /**
  * Assert that out of stock product is visible in the assigned category.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory|null $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
 {
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, "Product is absent on category page.");
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:20,代码来源:AssertProductOutOfStockVisibleInCategory.php

示例11: processAssert

 /**
  * Assert that products are absent in category frontend page.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategory $category
  * @param array $unassignedProducts
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogCategory $category, array $unassignedProducts)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     foreach ($unassignedProducts as $product) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
         while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
             $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
         }
         \PHPUnit_Framework_Assert::assertFalse($isProductVisible, "Product {$product->getName()} is present in category page.");
     }
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:21,代码来源:AssertProductsNotVisibleInCategory.php

示例12: processAssert

 /**
  * Assert that created Order By Sku widget displayed on frontend in Catalog.
  *
  * @param CatalogCategory $category
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param Widget $widget
  * @param Cache $adminCache
  * @return void
  */
 public function processAssert(CatalogCategory $category, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, Widget $widget, Cache $adminCache)
 {
     $category->persist();
     // Flush cache
     $adminCache->open();
     $adminCache->getPageActions()->flushCacheStorage();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($category->getName());
     $errors = $catalogCategoryView->getWidgetView()->checkWidget($widget, "Order by SKU");
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:22,代码来源:AssertWidgetOrderBySkuOnCategoryPage.php

示例13: processAssert

 /**
  * Assert that product products' MAP has been applied on gesture.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategory $category
  * @param array $products
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, CatalogCategory $category, array $products)
 {
     foreach ($products as $product) {
         $productName = $product->getName();
         $cmsIndex->open();
         $cmsIndex->getTopmenu()->selectCategory($category->getName());
         $listProductBlock = $catalogCategoryView->getListProductBlock();
         // Check that price is present in MAP popup.
         $productPriceBlock = $listProductBlock->getProductPriceBlock($productName);
         $productPriceBlock->clickForPrice();
         $msrpPopupBlock = $productPriceBlock->getMapBlock();
         $map = $msrpPopupBlock->isVisible() ? $msrpPopupBlock->getMap() : null;
         \PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2), $map, "MAP of {$productName} product is not visible or not equal to product price.");
     }
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:24,代码来源:AssertProductMapAppliedOnGesture.php

示例14: processAssert

 /**
  * Assert that product is visible in the assigned category.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory|null $category
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
 {
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     if ($product->getVisibility() === 'Search' || $this->getStockStatus($product) === 'Out of Stock') {
         $isProductVisible = !$isProductVisible;
         $this->errorMessage = 'Product found in this category.';
         $this->successfulMessage = 'Asserts that the product could not be found in this category.';
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, $this->errorMessage);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:27,代码来源:AssertProductVisibleInCategory.php

示例15: __prepare

 /**
  * Prepare data.
  *
  * @param CatalogCategory $category
  * @param CatalogProduct $productGrid
  * @param CatalogProductEdit $editProductPage
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function __prepare(CatalogCategory $category, CatalogProduct $productGrid, CatalogProductEdit $editProductPage, FixtureFactory $fixtureFactory)
 {
     $this->category = $category;
     $this->category->persist();
     $this->productGrid = $productGrid;
     $this->editProductPage = $editProductPage;
     $this->fixtureFactory = $fixtureFactory;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:17,代码来源:DuplicateProductEntityTest.php


注:本文中的Mage\Catalog\Test\Fixture\CatalogCategory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。