• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Fixture\FixtureInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: processAssert

 /**
  * Assert that product is displayed in up-sell section
  *
  * @param BrowserInterface $browser
  * @param FixtureInterface $product
  * @param InjectableFixture[] $relatedProducts,
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(BrowserInterface $browser, FixtureInterface $product, array $relatedProducts, CatalogProductView $catalogProductView)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($relatedProducts as $relatedProduct) {
         \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getUpsellBlock()->isUpsellProductVisible($relatedProduct->getName()), 'Product \'' . $relatedProduct->getName() . '\' is absent in up-sells products.');
     }
 }
开发者ID:,项目名称:,代码行数:16,代码来源:


示例2: persist

 /**
  * Post request for creating simple product
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  * @throws \Exception
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $config = $fixture->getDataConfig();
     $prefix = isset($config['input_prefix']) ? $config['input_prefix'] : null;
     // @todo remove "if" when fixtures refactored
     if ($fixture instanceof InjectableFixture) {
         $fields = $fixture->getData();
         if ($prefix) {
             $data[$prefix] = $fields;
         } else {
             $data = $fields;
         }
     } else {
         $data = $this->_prepareData($fixture->getData('fields'), $prefix);
     }
     if ($fixture->getData('category_id')) {
         $data['product']['category_ids'] = $fixture->getCategoryIds();
     }
     $url = $this->_getUrl($config);
     $curl = new BackendDecorator(new CurlTransport(), new Config());
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Product creation by curl handler was not successful! Response: {$response}");
     }
     preg_match("~Location: [^\\s]*\\/id\\/(\\d+)~", $response, $matches);
     return isset($matches[1]) ? $matches[1] : null;
 }
开发者ID:,项目名称:,代码行数:39,代码来源:


示例3: getGroupedPrice

 /**
  * Get grouped price with fixture product and product page
  *
  * @param View $view
  * @param FixtureInterface $product
  * @return array
  */
 protected function getGroupedPrice(View $view, FixtureInterface $product)
 {
     $fields = $product->getData();
     $groupPrice['onPage'] = $view->getPriceBlock()->getSpecialPrice();
     $groupPrice['fixture'] = number_format($fields['group_price'][array_search($this->customerGroup, $fields['group_price'])]['price'], 2);
     return $groupPrice;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:AssertProductGroupedPriceOnProductPage.php


示例4: prepareData

 /**
  * Prepare data from text to values
  *
  * @param FixtureInterface $fixture
  * @return array
  */
 protected function prepareData(FixtureInterface $fixture)
 {
     $data = ['store' => $this->replaceMappingData($fixture->getData()), 'store_action' => 'add', 'store_type' => 'store'];
     $data['store']['group_id'] = $fixture->getDataFieldConfig('group_id')['source']->getStoreGroup()->getGroupId();
     $data['store']['store_id'] = isset($data['store']['store_id']) ? $data['store']['store_id'] : '';
     return $data;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:13,代码来源:Curl.php


示例5: fill

 /**
  * Fill the customer data
  *
  * @param FixtureInterface $customer
  * @param SimpleElement|null $element
  * @return $this
  */
 public function fill(FixtureInterface $customer, SimpleElement $element = null)
 {
     /** @var Customer $customer */
     if ($customer->hasData()) {
         return parent::fill($customer, $element);
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:CustomerForm.php


示例6: prepareFilter

 /**
  * Prepare filter for assert.
  *
  * @param FixtureInterface $product
  * @param array $review
  * @param string $gridStatus [optional]
  * @return array
  *
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function prepareFilter(FixtureInterface $product, array $review, $gridStatus = '')
 {
     $filter = [];
     foreach ($this->filter as $key => $item) {
         list($type, $param) = [$key, $item];
         if (is_numeric($key)) {
             $type = $param = $item;
         }
         switch ($param) {
             case 'name':
             case 'sku':
                 $value = $product->getData($param);
                 break;
             case 'select_stores':
                 $value = isset($review[$param]) ? $review[$param][0] : null;
                 break;
             case 'status_id':
                 $value = $gridStatus != '' ? $gridStatus : (isset($review[$param]) ? $review[$param] : null);
                 break;
             case 'type':
                 $value = isset($review[$param]) ? $review[$param] : 'Administrator';
                 break;
             default:
                 $value = isset($review[$param]) ? $review[$param] : null;
                 break;
         }
         if ($value !== null) {
             $filter += [$type => $value];
         }
     }
     return $filter;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:42,代码来源:AssertProductReviewInGrid.php


示例7: prepareData

 /**
  * Prepare data for POST request.
  *
  * @param FixtureInterface $fixture
  * @return array
  */
 protected function prepareData(FixtureInterface $fixture)
 {
     $result = [];
     $data = $fixture->getData();
     $result['rate'][$data['currency_from']][$data['currency_to']] = $data['rate'];
     return $result;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:13,代码来源:Curl.php


示例8: fill

 /**
  * Fill the root form.
  *
  * @param FixtureInterface $fixture
  * @param SimpleElement|null $element
  * @param array|null $mapping
  * @return $this
  */
 public function fill(FixtureInterface $fixture, SimpleElement $element = null, array $mapping = null)
 {
     $attribute = $fixture->getDataFieldConfig('custom_attribute')['source']->getAttribute();
     $mapping['custom_attribute']['selector'] = sprintf($this->inputSelector, $attribute->getAttributeCode());
     $this->_fill($mapping, $element);
     return $this;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:Text.php


示例9: prepareVariationsMatrix

 /**
  * Preparing matrix data
  *
  * @param FixtureInterface $product
  * @return array
  */
 protected function prepareVariationsMatrix(FixtureInterface $product)
 {
     /** @var ConfigurableAttributesData $configurableAttributesData */
     $configurableAttributesData = $product->getDataFieldConfig('configurable_attributes_data')['source'];
     $attributesData = $configurableAttributesData->getAttributesData();
     $assignedProducts = $configurableAttributesData->getProducts();
     $matrixData = $product->getConfigurableAttributesData()['matrix'];
     $result = [];
     foreach ($matrixData as $variationKey => $variation) {
         // For assigned products doesn't send data about them
         if (isset($assignedProducts[$variationKey])) {
             continue;
         }
         $compositeKeys = explode(' ', $variationKey);
         $keyIds = [];
         $configurableAttribute = [];
         foreach ($compositeKeys as $compositeKey) {
             list($attributeKey, $optionKey) = explode(':', $compositeKey);
             $attribute = $attributesData[$attributeKey];
             $keyIds[] = $attribute['options'][$optionKey]['id'];
             $configurableAttribute[] = sprintf('"%s":"%s"', $attribute['attribute_code'], $attribute['options'][$optionKey]['id']);
         }
         $keyIds = implode('-', $keyIds);
         $variation['configurable_attribute'] = '{' . implode(',', $configurableAttribute) . '}';
         $result[$keyIds] = $variation;
     }
     return $result;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:34,代码来源:Curl.php


示例10: getData

 /**
  * Get data of the tabs.
  *
  * @param FixtureInterface|null $fixture
  * @param Element|null $element
  * @return array
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function getData(FixtureInterface $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:QiuLihua83,项目名称:magento-ee,代码行数:38,代码来源:WidgetForm.php


示例11: getPreparedData

 /**
  * Prepare and return data of review
  *
  * @param FixtureInterface $review
  * @return array
  */
 protected function getPreparedData(FixtureInterface $review)
 {
     $data = $review->getData();
     /* Prepare ratings */
     if ($review->hasData('ratings')) {
         $sourceRatings = $review->getDataFieldConfig('ratings')['source'];
         $ratings = [];
         foreach ($data['ratings'] as $rating) {
             $ratings[$rating['title']] = $rating['rating'];
         }
         $data['ratings'] = [];
         foreach ($sourceRatings->getRatings() as $ratingFixture) {
             /** @var Rating $ratingFixture */
             $ratingCode = $ratingFixture->getRatingCode();
             if (isset($ratings[$ratingCode])) {
                 $ratingOptions = $ratingFixture->getOptions();
                 $vote = $ratings[$ratingCode];
                 $data['ratings'][$ratingFixture->getRatingId()] = $ratingOptions[$vote];
             }
         }
     }
     if ($review->hasData('select_stores')) {
         foreach (array_keys($data['select_stores']) as $key) {
             if (isset($this->mappingData['select_stores'][$data['select_stores'][$key]])) {
                 $data['select_stores'][$key] = $this->mappingData['select_stores'][$data['select_stores'][$key]];
             }
         }
     }
     /* Prepare product id */
     $data['product_id'] = $data['entity_id'];
     unset($data['entity_id']);
     return $data;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:39,代码来源:Curl.php


示例12: prepareFilter

 /**
  * Prepare filter for assert
  *
  * @param FixtureInterface $product
  * @param Review $review
  * @param string $gridStatus
  * @return array
  */
 public function prepareFilter(FixtureInterface $product, Review $review, $gridStatus)
 {
     $filter = [];
     foreach ($this->filter as $key => $item) {
         list($type, $param) = [$key, $item];
         if (is_numeric($key)) {
             $type = $param = $item;
         }
         switch ($param) {
             case 'name':
             case 'sku':
                 $value = $product->getData($param);
                 break;
             case 'select_stores':
                 $value = $review->getData($param)[0];
                 break;
             case 'status_id':
                 $value = $gridStatus != '' ? $gridStatus : $review->getData($param);
                 break;
             default:
                 $value = $review->getData($param);
                 break;
         }
         if ($value !== null) {
             $filter += [$type => $value];
         }
     }
     return $filter;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:37,代码来源:AssertProductReviewNotInGrid.php


示例13: prepareData

 /**
  * Prepare data for curl.
  *
  * @param FixtureInterface $fixture
  * @return array
  */
 protected function prepareData(FixtureInterface $fixture)
 {
     $data = ['catalogevent' => $this->replaceMappingData($fixture->getData())];
     $data['catalogevent']['display_state'] = array_values($data['catalogevent']['display_state']);
     $categoryId = isset($data['catalogevent']['category_id']['id']) ? $data['catalogevent']['category_id']['id'] : $fixture->getDataFieldConfig('category_id')['source']->getCategory()->getId();
     return ['data' => $data, 'categoryId' => $categoryId];
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:13,代码来源:Curl.php


示例14: fillCustom

 /**
  * Fill form with custom fields.
  * (for End To End Tests)
  *
  * @param FixtureInterface $fixture
  * @param array $fields
  * @param SimpleElement $element
  */
 public function fillCustom(FixtureInterface $fixture, array $fields, SimpleElement $element = null)
 {
     $data = $fixture->getData('fields');
     $dataForMapping = array_intersect_key($data, array_flip($fields));
     $mapping = $this->dataMapping($dataForMapping);
     $this->_fill($mapping, $element);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:Form.php


示例15: fill

 /**
  * Fill the root form.
  *
  * @param FixtureInterface $fixture
  * @param SimpleElement|null $element
  * @return $this
  */
 public function fill(FixtureInterface $fixture, SimpleElement $element = null)
 {
     // Prepare price data
     $data = $fixture->getData();
     if (isset($data['price'])) {
         $data = array_merge($data, $data['price']);
         unset($data['price']);
     }
     // Mapping
     $mapping = $this->dataMapping($data);
     $attributeType = $attributeCode = '';
     if ($fixture->hasData('custom_attribute')) {
         /** @var CatalogProductAttribute $attribute */
         $attribute = $fixture->getDataFieldConfig('custom_attribute')['source']->getAttribute();
         $attributeType = $attribute->getFrontendInput();
         $attributeCode = $attribute->getAttributeCode();
     }
     if ($this->hasRender($attributeType)) {
         $element = $this->_rootElement->find(sprintf($this->customAttributeSelector, $attributeCode));
         $arguments = ['fixture' => $fixture, 'element' => $element, 'mapping' => $mapping];
         $this->callRender($attributeType, 'fill', $arguments);
     } else {
         $this->_fill($mapping, $element);
     }
     return $this;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:33,代码来源:Form.php


示例16: fill

 /**
  * Fill the root form.
  *
  * @param FixtureInterface $review
  * @param SimpleElement|null $element
  * @return $this
  */
 public function fill(FixtureInterface $review, SimpleElement $element = null)
 {
     if ($review->hasData('ratings')) {
         $this->fillRatings($review);
     }
     return parent::fill($review, $element);
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:14,代码来源:Form.php


示例17: prepareData

 /**
  * Prepare data from text to values
  *
  * @param FixtureInterface $fixture
  * @return array
  */
 protected function prepareData($fixture)
 {
     $data = $this->replaceMappingData($fixture->getData());
     if (isset($data['website_ids'])) {
         $websiteIds = [];
         foreach ($data['website_ids'] as $websiteId) {
             $websiteIds[] = isset($this->websiteIds[$websiteId]) ? $this->websiteIds[$websiteId] : $websiteId;
         }
         $data['website_ids'] = $websiteIds;
     }
     if (isset($data['customer_group_ids'])) {
         $customerGroupIds = [];
         foreach ($data['customer_group_ids'] as $customerGroupId) {
             $customerGroupIds[] = isset($this->customerGroupIds[$customerGroupId]) ? $this->customerGroupIds[$customerGroupId] : $customerGroupId;
         }
         $data['customer_group_ids'] = $customerGroupIds;
     }
     if (!isset($data['stop_rules_processing'])) {
         $data['stop_rules_processing'] = 0;
     }
     if (!isset($data['rule'])) {
         $data['rule'] = null;
     }
     $data['rule'] = ['conditions' => $this->prepareCondition($data['rule'])];
     return $data;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:32,代码来源:Curl.php


示例18: persist

 /**
  * Post request for creating sales rule.
  *
  * @param FixtureInterface $fixture
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $this->mapTypeParams = array_merge($this->mapTypeParams, $this->additionalMapTypeParams);
     $url = $_ENV['app_backend_url'] . 'sales_rule/promo_quote/save/';
     $data = $this->replaceMappingData($fixture->getData());
     $data['rule'] = [];
     if (isset($data['conditions_serialized'])) {
         $data['rule']['conditions'] = $this->prepareCondition($data['conditions_serialized']);
         unset($data['conditions_serialized']);
     }
     $data['website_ids'] = $this->prepareWebsites($data);
     $data['customer_group_ids'] = $this->prepareCustomerGroup($data);
     if (isset($data['actions_serialized'])) {
         $this->mapTypeParams['Conditions combination']['type'] = 'Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Combine';
         $data['rule']['actions'] = $this->prepareCondition($data['actions_serialized']);
         unset($data['actions_serialized']);
     }
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Sales rule entity creating by curl handler was not successful! Response: {$response}");
     }
     preg_match('`<tr.*title=".*sales_rule\\/promo_quote\\/edit\\/id\\/([\\d]+)`ims', $response, $matches);
     if (empty($matches)) {
         throw new \Exception('Cannot find Sales Rule id');
     }
     return ['id' => $matches[1]];
 }
开发者ID:opexsw,项目名称:magento2,代码行数:37,代码来源:Curl.php


示例19: processAssert

 /**
  * Assert that products are displayed in up-sell section.
  *
  * @param Browser $browser
  * @param FixtureInterface $product
  * @param array $upSellProducts
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function processAssert(Browser $browser, FixtureInterface $product, array $upSellProducts, CatalogProductView $catalogProductView)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     foreach ($upSellProducts as $upSellProduct) {
         \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getUpsellBlock()->getItemBlock($upSellProduct)->isVisible(), "Product {$upSellProduct->getName()} is absent in up-sells products.");
     }
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:16,代码来源:AssertUpSellProductsSection.php


示例20: getOptions

 /**
  * Get configurable product options
  *
  * @param FixtureInterface|null $product [optional]
  * @return array
  * @throws \Exception
  */
 public function getOptions(FixtureInterface $product)
 {
     /** @var ConfigurableProduct $product */
     $attributesData = $product->hasData('configurable_attributes_data') ? $product->getConfigurableAttributesData()['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 SimpleElement $optionElement */
         $optionElement = $listOptions[$title];
         $typeMethod = preg_replace('/[^a-zA-Z]/', '', $option['frontend_input']);
         $getTypeData = 'get' . ucfirst(strtolower($typeMethod)) . 'Data';
         $optionData = $this->{$getTypeData}($optionElement);
         $optionData['title'] = $title;
         $optionData['type'] = $option['frontend_input'];
         $optionData['is_require'] = $optionElement->find($this->required, Locator::SELECTOR_XPATH)->isVisible() ? 'Yes' : 'No';
         foreach ($optionData['options'] as $key => $value) {
             $optionData['options'][$key]['price'] = $this->getOptionPrice($title, $value['title']);
         }
         $result[$title] = $optionData;
     }
     return $result;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:33,代码来源:ConfigurableOptions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Fixture\InjectableFixture类代码示例发布时间:2022-05-23
下一篇:
PHP Fixture\FixtureFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap