當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FixtureInterface::getData方法代碼示例

本文整理匯總了PHP中Mtf\Fixture\FixtureInterface::getData方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureInterface::getData方法的具體用法?PHP FixtureInterface::getData怎麽用?PHP FixtureInterface::getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mtf\Fixture\FixtureInterface的用法示例。


在下文中一共展示了FixtureInterface::getData方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例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: 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

示例4: 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

示例5: 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

示例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: 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

示例8: 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

示例9: 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

示例10: persist

 /**
  * Post request for creating tax class
  *
  * @param FixtureInterface $fixture [optional]
  * @return mixed|string
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $fixture->getData();
     $url = $_ENV['app_backend_url'] . 'tax/tax/ajaxSAve/?isAjax=true';
     $curl = new BackendDecorator(new CurlTransport(), new Config());
     $curl->write(CurlInterface::POST, $url, '1.0', array(), $data);
     $response = $curl->read();
     $curl->close();
     $id = $this->getClassId($response);
     return ['id' => $id];
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:17,代碼來源:Curl.php

示例11: fill

 /**
  * Fill popup form
  *
  * @param FixtureInterface $product
  * @param Element|null $element [optional]
  * @return $this
  */
 public function fill(FixtureInterface $product, Element $element = null)
 {
     $affectedAttributeSet = $product->getData('affected_attribute_set');
     if ($affectedAttributeSet) {
         $fields = ['new_attribute_set_name' => $affectedAttributeSet];
         $mapping = $this->dataMapping($fields);
         $this->_rootElement->find($this->affectedAttributeSetNew)->click();
         $this->_fill($mapping, $element);
     }
     return $this;
 }
開發者ID:buskamuza,項目名稱:magento2-skeleton,代碼行數:18,代碼來源:AffectedAttributeSet.php

示例12: fill

 /**
  * Fill popup form
  *
  * @param FixtureInterface $product
  * @param Element|null $element
  * @return $this
  */
 public function fill(FixtureInterface $product, Element $element = null)
 {
     $data = $product->getData('affect_configurable_product_attributes');
     if (!empty($data)) {
         $this->_rootElement->find($this->affectedAttributeSetNew)->click();
         $fields = ['new_attribute_set_name' => strval($data)];
         $mapping = $this->dataMapping($fields);
         $this->_fill($mapping, $element);
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:AffectedAttributeSetForm.php

示例13: prepareData

 /**
  * Prepare POST data for creating customer request
  *
  * @param FixtureInterface $fixture
  * @return array
  */
 protected function prepareData(FixtureInterface $fixture)
 {
     $data = $fixture->getData('fields');
     foreach ($data as $key => $values) {
         $value = $this->getValue($values);
         if (null === $value) {
             continue;
         }
         $data[$key] = $value;
     }
     return $data;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:18,代碼來源:CreateCustomerGroup.php

示例14: persist

 /**
  * Post request for creating url rewrite
  *
  * @param FixtureInterface $fixture
  * @throws \Exception
  * @return mixed|void
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . $this->url . $fixture->getIdPath();
     $data = $this->replaceMappingData($fixture->getData());
     $curl = new BackendDecorator(new CurlTransport(), new Config());
     $curl->write(CurlInterface::POST, $url, '1.0', array(), $data);
     $response = $curl->read();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Product creation by curl handler was not successful! Response: {$response}");
     }
     $curl->close();
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:19,代碼來源:Curl.php

示例15: persist

 /**
  * Post request for creating Product Attribute
  *
  * @param FixtureInterface|null $fixture [optional]
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->replaceMappingData($fixture->getData());
     $data['frontend_label'] = [0 => $data['frontend_label']];
     if (isset($data['options'])) {
         foreach ($data['options'] as $key => $values) {
             if ($values['is_default'] == 'Yes') {
                 $data['default'][] = $values['view'];
             }
             $index = 'option_' . $key;
             $data['option']['value'][$index] = [$values['admin'], $values['view']];
             $data['option']['order'][$index] = $key;
         }
         unset($data['options']);
     }
     $url = $_ENV['app_backend_url'] . 'catalog/product_attribute/save/back/edit';
     $curl = new BackendDecorator(new CurlTransport(), new Config());
     $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 Attribute creating by curl handler was not successful!");
     }
     $resultData = [];
     $matches = [];
     preg_match('#attribute_id[^>]+value="(\\d+)"#', $response, $matches);
     $resultData['attribute_id'] = $matches[1];
     $matches = [];
     preg_match_all('#"id":"(\\d+)"#Umi', $response, $matches);
     if ($fixture->hasData('options')) {
         $optionsData = $fixture->getData()['options'];
         foreach ($matches[1] as $key => $optionId) {
             $optionsData[$key]['id'] = $optionId;
         }
         $resultData['options'] = $optionsData;
     }
     return $resultData;
 }
開發者ID:buskamuza,項目名稱:magento2-skeleton,代碼行數:45,代碼來源:Curl.php


注:本文中的Mtf\Fixture\FixtureInterface::getData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。