本文整理汇总了PHP中Magento\Mtf\Fixture\InjectableFixture::getDataFieldConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP InjectableFixture::getDataFieldConfig方法的具体用法?PHP InjectableFixture::getDataFieldConfig怎么用?PHP InjectableFixture::getDataFieldConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Fixture\InjectableFixture
的用法示例。
在下文中一共展示了InjectableFixture::getDataFieldConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareData
/**
* Prepare data.
*
* @param InjectableFixture $fixture
* @param $isSearchByEmail
* @return array
*/
protected function prepareData(InjectableFixture $fixture, $isSearchByEmail)
{
/** @var Order $fixture */
/** @var Customer $customer */
$customer = $fixture->getDataFieldConfig('customer_id')['source']->getCustomer();
$data = ['order_id' => $fixture->getId(), 'billing_last_name' => $customer->getLastname()];
if ($isSearchByEmail) {
$data['find_order_by'] = 'Email';
$data['email_address'] = $customer->getEmail();
} else {
$data['find_order_by'] = 'ZIP Code';
$data['billing_zip_code'] = $fixture->getDataFieldConfig('billing_address_id')['source']->getPostcode();
}
return $data;
}
示例2: 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()));
}
示例3: 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.');
}
示例4: getAssociatedItems
/**
* Get associated items for grouped product.
*
* @param InjectableFixture $product
* @return array
*/
protected function getAssociatedItems(InjectableFixture $product)
{
$cartItems = [];
/** @var GroupedProduct $product */
$associatedProducts = $product->getDataFieldConfig('associated')['source']->getProducts();
foreach ($associatedProducts as $product) {
$cartItems[$product->getSku()] = parent::getCartItem($product);
}
return $cartItems;
}
示例5: getFullPathCategories
/**
* Get full path for all categories.
*
* @return array
*/
protected function getFullPathCategories()
{
$result = [];
$categories = $this->product->getDataFieldConfig('category_ids')['source']->getCategories();
foreach ($categories as $key => $itemCategory) {
$fullPath = $this->prepareFullCategoryPath($itemCategory);
$result[$key] = implode('/', $fullPath);
}
return $result;
}
示例6: prepareFpt
/**
* Preparation of fpt attribute data.
*
* @return void
*/
protected function prepareFpt()
{
if ($this->fixture->hasData('fpt')) {
$fptLabel = $this->fixture->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getFrontendLabel();
$fptValues = $this->fields['product'][$fptLabel];
foreach ($fptValues as $key => $item) {
$item['value'] = $item['price'];
unset($item['price']);
$fptValues[$key] = $item;
}
$this->fields['product']['custom_attributes'][] = ['attribute_code' => $fptLabel, 'value' => $fptValues];
unset($this->fields['product'][$fptLabel]);
}
}
示例7: prepareFpt
/**
* Preparation of fpt attribute data.
*
* @return void
*/
protected function prepareFpt()
{
if (isset($this->fields['product']['fpt'])) {
$attributeLabel = $this->fixture->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getFrontendLabel();
foreach ($this->fields['product']['fpt'] as &$field) {
foreach ($this->fptData as $key => $data) {
$field[$data['name']] = $this->fptData[$key]['data'][$field[$key]];
unset($field[$key]);
}
$field['delete'] = '';
}
$this->fields['product'][$attributeLabel] = $this->fields['product']['fpt'];
unset($this->fields['product']['fpt']);
}
}
示例8: prepareTierPrices
/**
* Prepare tier price data.
*
* @param InjectableFixture $product
* @return array
*/
protected function prepareTierPrices(InjectableFixture $product)
{
$tierPrices = $product->getTierPrice();
$percents = $product->getDataFieldConfig('price')['source']->getPreset();
foreach ($tierPrices as $key => $tierPrice) {
$tierPrices[$key]['price'] = number_format($tierPrices[$key]['price'], $this->priceFormat);
$tierPrices[$key]['percent'] = $percents[$key]['percent'];
}
return $tierPrices;
}
示例9: prepareAttributeData
/**
* Prepare attribute data.
*
* @param InjectableFixture $product
* @param int $key
* @return array
*/
protected function prepareAttributeData(InjectableFixture $product, $key)
{
$data = [];
foreach ($this->attributeProduct as $attributeKey => $attribute) {
$value = $attribute;
$attribute = is_numeric($attributeKey) ? $attribute : $attributeKey;
$attributeValue = $attribute != 'price' ? $product->hasData($attribute) ? $product->getData($attribute) : 'N/A' : ($product->getDataFieldConfig('price')['source']->getPreset() !== null ? $product->getDataFieldConfig('price')['source']->getPreset() : number_format($product->getPrice(), 2));
$data['attributeValues'][$attribute] = !is_array($attributeValue) ? strtolower($attributeValue) : $attributeValue;
$attributeName = $value === 'name' || $value === 'price' ? 'Info' : 'MetaData';
$data['attributeValuesFromPage'][$attribute] = $this->comparePage->getCompareProductsBlock()->{'getProduct' . $attributeName}($key + 1, $value);
}
return $data;
}
示例10: getAssignedProducts
/**
* Get assigned products.
*
* @param InjectableFixture $product
* @return array
*/
protected function getAssignedProducts(InjectableFixture $product)
{
return $product->getDataFieldConfig('configurable_options')['source']->getProducts();
}
示例11: getFixtureFieldsByContainers
/**
* Create data array for filling containers.
*
* Returns data in format
* [[abstract_container_name => [field_name => [attribute_name => attribute_value, ..], ..], ..]
* where container name should be set to 'null' if a field is not present on the form.
*
* @param InjectableFixture $fixture
* @return array
*/
protected function getFixtureFieldsByContainers(InjectableFixture $fixture)
{
$dataByContainer = [];
$data = $fixture->getData();
foreach ($data as $field => $value) {
$attributes = $fixture->getDataFieldConfig($field);
$attributes['value'] = $value;
if (array_key_exists('group', $attributes) && $attributes['group'] != 'null') {
$dataByContainer[$attributes['group']][$field] = $attributes;
} elseif (!array_key_exists('group', $attributes)) {
$this->unassignedFields[$field] = $attributes;
}
}
return $dataByContainer;
}
示例12: prepareConfig
/**
* Prepare config data.
*
* @param InjectableFixture $product
* @return array
*/
protected function prepareConfig(InjectableFixture $product)
{
$config = $product->getDataConfig();
if ($product->hasData('attribute_set_id')) {
$config['create_url_params']['set'] = $product->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()->getAttributeSetId();
}
return $config;
}
示例13: prepareCatalogPriceRule
/**
* Prepare catalog price rule.
*
* @param string $dataSet
* @return CatalogRule
*/
protected function prepareCatalogPriceRule($dataSet)
{
$rule = $this->fixtureFactory->createByCode('catalogRule', ['dataSet' => $dataSet])->getData('rule');
if ($this->product->hasData('category_ids')) {
$pattern = '[Category|is|%d]';
$category = $this->product->getDataFieldConfig('category_ids')['source']->getProductCategory();
$rule = sprintf($pattern, $category->getId());
}
return $this->fixtureFactory->createByCode('catalogRule', ['dataSet' => $dataSet, 'data' => ['rule' => $rule]]);
}
示例14: getFptLabel
/**
* Get fpt label.
*
* @param InjectableFixture $product
* @return string
*/
protected function getFptLabel(InjectableFixture $product)
{
return $product->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getFrontendLabel();
}
示例15: getOrderItems
/**
* Get order items from rma fixture.
*
* @param InjectableFixture $fixture
* @return array
*/
protected function getOrderItems(InjectableFixture $fixture)
{
/** @var OrderId $sourceOrderId */
$sourceOrderId = $fixture->getDataFieldConfig('order_id')['source'];
return $sourceOrderId->getOrder()->getEntityId()['products'];
}