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


PHP Fixture\InjectableFixture类代码示例

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


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

示例1: processAssert

 /**
  * Check whether the attribute filter is displayed on the frontend in Layered navigation.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param CmsIndex $cmsIndex
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory)
 {
     $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['category_ids' => ['presets' => null, 'category' => $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]]]])->persist();
     $cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:AssertProductAttributeIsFilterable.php

示例2: prepareFixturePrice

 /**
  * Prepare product price from fixture.
  *
  * @param InjectableFixture $product
  * @return float
  */
 protected function prepareFixturePrice(InjectableFixture $product)
 {
     /** @var CatalogProductSimple $product */
     $customOptions = $product->getCustomOptions();
     $checkoutData = $product->getCheckoutData();
     $checkoutCustomOptions = isset($checkoutData['options']['custom_options']) ? $checkoutData['options']['custom_options'] : [];
     if (isset($checkoutData['cartItem'])) {
         $fixturePrice = $checkoutData['cartItem']['price'];
     } else {
         $fixturePrice = $product->getPrice();
         $groupPrice = $product->getGroupPrice();
         $specialPrice = $product->getSpecialPrice();
         if ($groupPrice) {
             $groupPrice = reset($groupPrice);
             $fixturePrice = $groupPrice['price'];
         }
         if ($specialPrice) {
             $fixturePrice = $specialPrice;
         }
         foreach ($checkoutCustomOptions as $checkoutOption) {
             $attributeKey = str_replace('attribute_key_', '', $checkoutOption['title']);
             $optionKey = str_replace('option_key_', '', $checkoutOption['value']);
             $option = $customOptions[$attributeKey]['options'][$optionKey];
             if ('Fixed' == $option['price_type']) {
                 $fixturePrice += $option['price'];
             } else {
                 $fixturePrice += $fixturePrice / 100 * $option['price'];
             }
         }
     }
     return $fixturePrice;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:38,代码来源:AssertProductInCart.php

示例3: getData

 /**
  * Get data of the tabs.
  *
  * @param InjectableFixture|null $fixture
  * @param Element|null $element
  * @return array
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function getData(InjectableFixture $fixture = null, Element $element = null)
 {
     $data = [];
     if (null === $fixture) {
         foreach ($this->tabs as $tabName => $tab) {
             $this->openTab($tabName);
             $tabData = $this->getTabElement($tabName)->getDataFormTab();
             $data = array_merge($data, $tabData);
         }
     } else {
         $tabsFields = $fixture->hasData() ? $this->getFieldsByTabs($fixture) : [];
         $tabsFields['frontend_properties'] = array_merge_recursive($tabsFields['frontend_properties'], $tabsFields['settings']);
         unset($tabsFields['settings']);
         foreach ($tabsFields as $tabName => $fields) {
             $this->openTab($tabName);
             if (isset($fields['widgetOptions'])) {
                 unset($fields['widgetOptions']['value']['type_id']);
                 $fields['widgetOptions'] = $fields['widgetOptions']['value'];
             } elseif (isset($fields['layout'])) {
                 $fields['layout'] = $fields['layout']['value'];
             }
             $tabData = $this->getTabElement($tabName)->getDataFormTab($fields, $this->_rootElement);
             $data = array_merge($data, $tabData);
         }
     }
     $data['type'] = $this->type[$data['type']];
     return $data;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:38,代码来源:WidgetForm.php

示例4: processAssert

 /**
  * Assert that redirect from newCategory/oldProduct is correct to new product.
  *
  * @param InjectableFixture $product
  * @param InjectableFixture $initialProduct
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(InjectableFixture $product, InjectableFixture $initialProduct, Browser $browser, CatalogProductView $catalogProductView)
 {
     $category = $product->getDataFieldConfig('category_ids')['source']->getProductCategory();
     $productUrl = $_ENV['app_frontend_url'] . $category->getUrlKey() . '/' . $initialProduct->getUrlKey() . '.html';
     $browser->open($productUrl);
     \PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()));
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:16,代码来源:AssertUrlRewriteUpdatedProductOnFrontend.php

示例5: processAssert

 /**
  * Assert that duplicated product can be found in grid by type, template, status and stock status.
  *
  * @param InjectableFixture $product
  * @param CatalogProduct $productGrid
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProduct $productGrid)
 {
     $config = $product->getDataConfig();
     $filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
     $productGrid->open()->getProductGrid()->search($filter);
     \PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false, false), 'Product duplicate is absent in Products grid.');
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:14,代码来源:AssertProductDuplicatedInGrid.php

示例6: getOptions

 /**
  * Get configurable product options.
  *
  * @param InjectableFixture|null $product [optional]
  * @return array
  * @throws \Exception
  */
 public function getOptions(InjectableFixture $product)
 {
     /** @var ConfigurableProduct $product */
     $attributesData = $product->hasData('configurable_options') ? $product->getConfigurableOptions()['attributes_data'] : [];
     $listOptions = $this->getListOptions();
     $result = [];
     foreach ($attributesData as $option) {
         $title = $option['label'];
         if (!isset($listOptions[$title])) {
             throw new \Exception("Can't find option: \"{$title}\"");
         }
         /** @var Element $optionElement */
         $optionElement = $listOptions[$title];
         $type = $option['frontend_input'];
         $option['frontend_input'] = explode('/', $option['frontend_input'])[1];
         $typeMethod = preg_replace('/[^a-zA-Z]/', '', $option['frontend_input']);
         $getTypeData = 'get' . ucfirst(strtolower($typeMethod)) . 'Data';
         $optionData = $this->{$getTypeData}($optionElement);
         $optionData['title'] = $title;
         $optionData['type'] = $type;
         $isRequire = $this->_rootElement->find(sprintf($this->required, $title), Locator::SELECTOR_XPATH)->isVisible();
         $optionData['is_require'] = $isRequire ? 'Yes' : 'No';
         $result[$title] = $optionData;
     }
     return $result;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:33,代码来源:ConfigurableOptions.php

示例7: getFormPrices

 /**
  * Get form prices.
  *
  * @param InjectableFixture $product
  * @param CatalogCategoryView $catalogCategoryView
  * @return array
  */
 protected function getFormPrices(InjectableFixture $product, CatalogCategoryView $catalogCategoryView)
 {
     $productPriceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($product->getName());
     $actualPrices = ['regular' => $productPriceBlock->getRegularPrice(), 'special' => $productPriceBlock->getSpecialPrice()];
     $actualPrices['discount_amount'] = number_format($actualPrices['regular'] - $actualPrices['special'], 2);
     return $actualPrices;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:14,代码来源:AssertCatalogPriceRuleAppliedInCatalogPage.php

示例8: processAssert

 /**
  * Assert that video is displayed on category page on Store front.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param InjectableFixture $initialProduct
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, InjectableFixture $initialProduct)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($initialProduct->getCategoryIds()[0]);
     $src = $catalogCategoryView->getListProductBlock()->getProductItem($initialProduct)->getBaseImageSource();
     \PHPUnit_Framework_Assert::assertFalse(strpos($src, '/placeholder/') !== false, 'Video preview image is not displayed on category view when it should.');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AssertVideoCategoryView.php

示例9: prepareTierPrices

 /**
  * Prepare tier price data.
  *
  * @param InjectableFixture $product
  * @return array
  */
 protected function prepareTierPrices(InjectableFixture $product)
 {
     $tierPrices = $product->getTierPrice();
     foreach ($tierPrices as $key => $tierPrice) {
         $tierPrices[$key]['price'] = number_format($tierPrices[$key]['price'], $this->priceFormat);
     }
     return $tierPrices;
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:14,代码来源:AssertProductTierPriceOnBundleProductPage.php

示例10: processAssert

 /**
  * Assertion that the product is correctly displayed in cart.
  *
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, InjectableFixture $product, Browser $browser, CheckoutCart $checkoutCart)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->addToCart($product);
     $checkoutData = $product->getCheckoutData();
     $price = $checkoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
     \PHPUnit_Framework_Assert::assertEquals($checkoutData['cartItem']['price'], $price, 'Product price in shopping cart is not correct.');
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:17,代码来源:AssertConfigurableProductInCart.php

示例11: processAssert

 /**
  * Assert that video data received from external service is correct.
  *
  * @param CatalogProductEdit $editProductPage
  * @param InjectableFixture $initialProduct
  * @param array $video
  * @return void
  */
 public function processAssert(CatalogProductEdit $editProductPage, InjectableFixture $initialProduct, array $video)
 {
     $editProductPage->open(['id' => $initialProduct->getId()]);
     $editProductPage->getProductForm()->openTab('images-and-videos');
     $imagesTab = $editProductPage->getProductForm()->getTab('images-and-videos');
     $result = $imagesTab->clickFirstVideo()->getVideoDialog()->validate($video);
     \PHPUnit_Framework_Assert::assertTrue($result, 'Video data received from external service is not correct.');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:16,代码来源:AssertGetVideoInfoDataIsCorrect.php

示例12: processAssert

 /**
  * Assert that video is not displayed in admin panel.
  *
  * @param CatalogProductIndex $productGrid
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProductIndex $productGrid, InjectableFixture $product)
 {
     $filter = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->search($filter);
     $src = $productGrid->getProductGrid()->getBaseImageSource();
     \PHPUnit_Framework_Assert::assertTrue(strpos($src, '/placeholder/') !== false, 'Product image is displayed in product grid when it should not');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:AssertProductNoImageInGrid.php

示例13: processAssert

 /**
  * Check whether there is an opportunity to compare products using given attribute.
  *
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductCompare $catalogProductCompare
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCompare();
     $catalogProductCompare->open();
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue($catalogProductCompare->getCompareProductsBlock()->isAttributeVisible($label), 'Attribute is absent on product compare page.');
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:18,代码来源:AssertProductAttributeIsComparable.php

示例14: processAssert

 /**
  * Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
  * according to Priority(Priority/Stop Further Rules Processing).
  *
  * @param InjectableFixture $product
  * @param CatalogProductView $pageCatalogProductView
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CheckoutCart $pageCheckoutCart
  * @param array $prices
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CheckoutCart $pageCheckoutCart, array $prices)
 {
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
     $catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
     $pageCatalogProductView->getViewBlock()->addToCart($product);
     $actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
     \PHPUnit_Framework_Assert::assertEquals($prices['grand_total'], $actualGrandTotal);
 }
开发者ID:test3metizsoft,项目名称:test,代码行数:21,代码来源:AssertCatalogPriceRuleAppliedInShoppingCart.php

示例15: getItemBlockElement

 /**
  * Get element for item block.
  *
  * @param InjectableFixture $address
  * @param int $itemIndex
  * @return ElementInterface
  */
 protected function getItemBlockElement(InjectableFixture $address, $itemIndex)
 {
     $conditions = [];
     foreach ($this->addressFields as $field) {
         $conditions[] = "contains(., '{$address->getData($field)}')";
     }
     $itemBlockSelector = sprintf($this->itemBlock, implode(' and ', $conditions));
     return $this->_rootElement->find($itemBlockSelector, Locator::SELECTOR_XPATH);
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:16,代码来源:Items.php


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