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

PHP Fixture\FixtureInterface类代码示例

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

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



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

示例1: persist

 /**
  * Post request for creating customer in frontend
  *
  * @param FixtureInterface|null $customer
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $customer = null)
 {
     $address = [];
     $result = [];
     /** @var CustomerInjectable $customer */
     $url = $_ENV['app_frontend_url'] . 'customer/account/createpost/?nocookie=true';
     $data = $customer->getData();
     if ($customer->hasData('address')) {
         $address = $customer->getAddress();
         unset($data['address']);
     }
     $curl = new CurlTransport();
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'data-ui-id="global-messages-message-success"')) {
         throw new \Exception("Customer entity creating  by curl handler was not successful! Response: {$response}");
     }
     $result['id'] = $this->getCustomerId($customer->getEmail());
     $data['customer_id'] = $result['id'];
     if (!empty($address)) {
         $data['address'] = $address;
         $this->addAddress($data);
     }
     return $result;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:33,代码来源:Curl.php


示例2: prepareFilter

 /**
  * Prepare filter for assert
  *
  * @param FixtureInterface $product
  * @param ReviewInjectable $review
  * @param string $gridStatus
  * @return array
  */
 public function prepareFilter(FixtureInterface $product, ReviewInjectable $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:aiesh,项目名称:magento2,代码行数:37,代码来源:AssertProductReviewNotInGrid.php


示例3: prepareData

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


示例4: getOptions

 /**
  * Get configurable product options
  *
  * @param FixtureInterface|null $product [optional]
  * @return array
  * @throws \Exception
  */
 public function getOptions(FixtureInterface $product)
 {
     if ($product instanceof InjectableFixture) {
         /** @var ConfigurableProductInjectable $product */
         $attributesData = $product->hasData('configurable_attributes_data') ? $product->getConfigurableAttributesData()['attributes_data'] : [];
     } else {
         /** @var ConfigurableProduct $product */
         $attributesData = $product->getConfigurableAttributes();
         foreach ($attributesData as $key => $attributeData) {
             $attributeData['label'] = $attributeData['label']['value'];
             $attributeData['frontend_input'] = 'dropdown';
             $attributesData[$key] = $attributeData;
         }
     }
     $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];
         $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';
         $result[$title] = $optionData;
     }
     return $result;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:40,代码来源:ConfigurableOptions.php


示例5: 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)
 {
     $groupPrice['onPage'] = $view->getProductPrice();
     $groupPrice['onPage'] = isset($groupPrice['onPage']['price_regular_price']) ? str_replace('As low as $', '', $groupPrice['onPage']['price_regular_price']) : str_replace('$', '', $groupPrice['onPage']['price_from']);
     $groupPrice['fixture'] = $product->getDataFieldConfig('price')['source']->getPreset()['price_from'];
     return $groupPrice;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:AssertGroupedPriceOnBundleProductPage.php


示例6: 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:aiesh,项目名称:magento2,代码行数:39,代码来源:Curl.php


示例7: persist

 /**
  * Post request for creating Subcategory
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data['general'] = $fixture->getData();
     foreach ($data['general'] as $key => $value) {
         if ($value == 'Yes') {
             $data['general'][$key] = 1;
         }
         if ($value == 'No') {
             $data['general'][$key] = 0;
         }
     }
     $diff = array_diff($this->dataUseConfig, array_keys($data['general']));
     if (!empty($diff)) {
         $data['use_config'] = $diff;
     }
     $parentCategoryId = $data['general']['parent_id'];
     $url = $_ENV['app_backend_url'] . 'catalog/category/save/store/0/parent/' . $parentCategoryId . '/';
     $curl = new BackendDecorator(new CurlTransport(), new Config());
     $curl->write(CurlInterface::POST, $url, '1.0', array(), $data);
     $response = $curl->read();
     $curl->close();
     preg_match('#http://.+/id/(\\d+).+store/#m', $response, $matches);
     $id = isset($matches[1]) ? $matches[1] : null;
     return ['id' => $id];
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:31,代码来源:Curl.php


示例8: persist

 /**
  * Curl creation of Admin User Role
  *
  * @param FixtureInterface $fixture
  * @return array|mixed
  * @throws \Exception
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $fixture->getData();
     $data['all'] = $data['resource_access'] == 'All' ? 1 : 0;
     if (isset($data['roles_resources'])) {
         foreach ($data['roles_resources'] as $resource) {
             $data['resource'][] = $resource;
         }
     }
     unset($data['roles_resources']);
     $data['gws_is_all'] = isset($data['gws_is_all']) ? $data['gws_is_all'] : '1';
     if ($fixture->hasData('in_role_user')) {
         $adminUsers = $fixture->getDataFieldConfig('in_role_user')['source']->getAdminUsers();
         $userIds = [];
         foreach ($adminUsers as $adminUser) {
             $userIds[] = $adminUser->getUserId() . "=true";
         }
         $data['in_role_user'] = implode('&', $userIds);
     }
     $url = $_ENV['app_backend_url'] . 'admin/user_role/saverole/active_tab/info/';
     $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("Role creating by curl handler was not successful! Response: {$response}");
     }
     $url = 'admin/user_role/roleGrid/sort/role_id/dir/desc/';
     $regExpPattern = '/class=\\"\\scol\\-id col\\-role_id\\W*>\\W+(\\d+)\\W+<\\/td>\\W+<td[\\w\\s\\"=\\-]*?>\\W+?' . $data['rolename'] . '/siu';
     $extractor = new Extractor($url, $regExpPattern);
     return ['role_id' => $extractor->getData()[1]];
 }
开发者ID:aiesh,项目名称:magento2,代码行数:42,代码来源:Curl.php


示例9: processAssert

 /**
  * Assert that displayed product data on product page(front-end) equals passed from fixture:
  * 1. Product Name
  * 2. Price
  * 3. Special price
  * 4. SKU
  * 5. Description
  * 6. Short Description
  *
  * @param Browser $browser
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(Browser $browser, CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->product = $product;
     $this->productView = $catalogProductView->getViewBlock();
     $errors = $this->verify();
     \PHPUnit_Framework_Assert::assertEmpty($errors, "\nFound the following errors:\n" . implode(" \n", $errors));
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:22,代码来源:AssertProductPage.php


示例10: processAssert

 /**
  * Assert form data equals fixture data
  *
  * @param FixtureInterface $product
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $productPage
  * @return void
  */
 public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
 {
     $filter = ['sku' => $product->getData('sku')];
     $productGrid->open()->getProductGrid()->searchAndOpen($filter);
     $fields = $this->convertDownloadableArray($this->prepareFixtureData($product));
     $fieldsForm = $productPage->getForm()->getData($product);
     \PHPUnit_Framework_Assert::assertEquals($fields, $fieldsForm, 'Form data not equals fixture data.');
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:16,代码来源:AssertDownloadableProductForm.php


示例11: init

 /**
  * Page initialization
  *
  * @param FixtureInterface $fixture
  * @return void
  */
 public function init(FixtureInterface $fixture)
 {
     $dataConfig = $fixture->getDataConfig();
     $params = isset($dataConfig['create_url_params']) ? $dataConfig['create_url_params'] : array();
     foreach ($params as $paramName => $paramValue) {
         $this->_url .= '/' . $paramName . '/' . $paramValue;
     }
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:14,代码来源:CatalogProductNew.php


示例12: prepareData

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


示例13: assertPrice

 /**
  * Verify product special price on product view page
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param string $block [optional]
  * @return void
  */
 public function assertPrice(FixtureInterface $product, CatalogProductView $catalogProductView, $block = '')
 {
     $fields = $product->getData();
     $specialPrice = $catalogProductView->getViewBlock()->getPriceBlock()->getSpecialPrice();
     if (isset($fields['special_price'])) {
         \PHPUnit_Framework_Assert::assertEquals(number_format($fields['special_price'], 2), $specialPrice, $this->errorMessage);
     }
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:16,代码来源:AssertProductSpecialPriceOnProductPage.php


示例14: persist

 /**
  * Create product
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     Factory::getApp()->magentoBackendLoginUser();
     $createProductPage = Factory::getPageFactory()->getCatalogProductNew();
     $createProductPage->open(['type' => $fixture->getDataConfig()['create_url_params']['type'], 'set' => $fixture->getDataConfig()['create_url_params']['set']]);
     $createProductPage->getProductForm()->fill($fixture);
     $createProductPage->getFormPageActions()->save();
     $createProductPage->getMessagesBlock()->assertSuccessMessage();
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:15,代码来源:CreateProduct.php


示例15: processAssert

 /**
  * Assertion that tier prices are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser)
 {
     //Open product view page
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $viewBlock = $catalogProductView->getViewBlock();
     $viewBlock->clickCustomize();
     //Process assertions
     $this->assertPrice($product, $catalogProductView);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:AssertTierPriceOnBundleProductPage.php


示例16: getDataCustomer

 /**
  * Get data of Customer information, addresses on tabs.
  *
  * @param FixtureInterface $customer
  * @param FixtureInterface|FixtureInterface[]|null $address
  * @return array
  */
 public function getDataCustomer(FixtureInterface $customer, $address = null)
 {
     $data = ['customer' => $customer->hasData() ? parent::getData($customer) : parent::getData()];
     if (null !== $address) {
         $this->openTab('addresses');
         $data['addresses'] = $this->getTabElement('addresses')->getDataAddresses($address);
     }
     return $data;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:CustomerForm.php


示例17: processAssert

 /**
  * Assert form data equals fixture data
  *
  * @param FixtureInterface $product
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $productPage
  * @return void
  */
 public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
 {
     $filter = ['sku' => $product->getSku() . '-1'];
     $productGrid->open()->getProductGrid()->searchAndOpen($filter);
     $formData = $productPage->getProductForm()->getData($product);
     $fixtureData = $this->prepareFixtureData($product->getData());
     $errors = $this->verifyData($fixtureData, $formData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:17,代码来源:AssertProductDuplicateForm.php


示例18: processAssert

 /**
  * Assert the product is not displayed on Compare Products page
  *
  * @param CatalogProductCompare $comparePage
  * @param FixtureInterface $product
  * @param int $countProducts [optional]
  * @return void
  */
 public function processAssert(CatalogProductCompare $comparePage, FixtureInterface $product, $countProducts = 0)
 {
     $comparePage->open();
     $compareBlock = $comparePage->getCompareProductsBlock();
     if ($countProducts > 1) {
         \PHPUnit_Framework_Assert::assertFalse($compareBlock->isProductVisibleInCompareBlock($product->getName()), 'The product displays on Compare Products page.');
     } else {
         \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $compareBlock->getEmptyMessage(), 'The product displays on Compare Products page.');
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:AssertProductIsNotVisibleInComparePage.php


示例19: processAssert

 /**
  * Assert form data equals fixture data
  *
  * @param FixtureInterface $product
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $productPage
  * @return void
  */
 public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
 {
     $filter = ['sku' => $product->getSku()];
     $productGrid->open()->getProductGrid()->searchAndOpen($filter);
     $fieldsForm = $productPage->getForm()->getData($product);
     $fieldsFixture = $this->prepareFixtureData($product->getData());
     $fieldsFixture['associated'] = $this->prepareGroupedOptions($fieldsFixture['associated']);
     $errors = $this->verifyData($fieldsFixture, $fieldsForm);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:18,代码来源:AssertGroupedProductForm.php


示例20: findCartItems

 /**
  * Find cart item blocks for associated products
  *
  * @param FixtureInterface $product
  * @return array
  */
 protected function findCartItems(FixtureInterface $product)
 {
     $cartItems = [];
     /** @var GroupedProductInjectable $product */
     $associatedProducts = $product->getAssociated()['products'];
     foreach ($associatedProducts as $product) {
         $cartItems[$product->getSku()] = parent::getCartItem($product);
     }
     return $cartItems;
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:16,代码来源:Cart.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP i18n\i18nClass类代码示例发布时间:2022-05-23
下一篇:
PHP Factory\Factory类代码示例发布时间: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