本文整理匯總了PHP中Mtf\Fixture\FixtureInterface::getDataConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureInterface::getDataConfig方法的具體用法?PHP FixtureInterface::getDataConfig怎麽用?PHP FixtureInterface::getDataConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mtf\Fixture\FixtureInterface
的用法示例。
在下文中一共展示了FixtureInterface::getDataConfig方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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();
}
示例2: persist
/**
* Post request for creating simple product
*
* @param FixtureInterface|null $fixture [optional]
* @return array
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function persist(FixtureInterface $fixture = null)
{
$config = $fixture->getDataConfig();
$prefix = isset($config['input_prefix']) ? $config['input_prefix'] : null;
$data = $this->prepareData($fixture, $prefix);
return ['id' => $this->createProduct($data, $config)];
}
示例3: processAssert
/**
* Assert that duplicated product is found by sku and has correct product type, product template,
* product status disabled and out of stock
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)
{
$config = $product->getDataConfig();
$filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'sku' => $product->getSku() . '-1', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
$productGrid->open()->getProductGrid()->search($filter);
$filter['price_to'] = '$' . $filter['price_to'];
\PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false), 'Product duplicate is absent in Products grid.');
}
示例4: 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;
}
}
示例5: getCartItem
/**
* Get cart item block
*
* @param FixtureInterface $product
* @return \Magento\Checkout\Test\Block\Cart\CartItem
*/
public function getCartItem(FixtureInterface $product)
{
$dataConfig = $product->getDataConfig();
$typeId = isset($dataConfig['type_id']) ? $dataConfig['type_id'] : null;
$cartItem = null;
if ($this->hasRender($typeId)) {
$cartItem = $this->callRender($typeId, 'getCartItem', ['product' => $product]);
} else {
$cartItemBlock = $this->_rootElement->find(sprintf($this->cartItemByProductName, $product->getName()), Locator::SELECTOR_XPATH);
$cartItem = $this->blockFactory->create('Magento\\Checkout\\Test\\Block\\Cart\\CartItem', ['element' => $cartItemBlock]);
}
return $cartItem;
}
示例6: save
/**
* Click on "Save" button
*
* @param FixtureInterface|null $product [optional]
* @return void
*/
public function save(FixtureInterface $product = null)
{
$typeId = null;
if ($product) {
$dataConfig = $product->getDataConfig();
$typeId = isset($dataConfig['type_id']) ? $dataConfig['type_id'] : null;
}
if ($this->hasRender($typeId)) {
$this->callRender($typeId, 'save', ['product' => $product]);
} else {
$this->_rootElement->find($this->saveButton)->click();
$this->waitForElementNotVisible($this->loader, Locator::SELECTOR_XPATH);
$this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH);
}
}
示例7: persist
/**
* Post request for creating bundle product
*
* @param FixtureInterface|null $fixture [optional]
* @return mixed|string
* @throws \Exception
*/
public function persist(FixtureInterface $fixture = null)
{
$config = $fixture->getDataConfig();
$prefix = isset($config['input_prefix']) ? $config['input_prefix'] : null;
$data = $this->_prepareData($fixture->getData('fields'), $prefix);
if ($fixture->getData('category_id')) {
$data['product']['category_ids'] = $fixture->getData('category_id');
}
$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;
}
示例8: fillOptions
/**
* Fill in the option specified for the product
*
* @param FixtureInterface $product
* @return void
*/
public function fillOptions(FixtureInterface $product)
{
$dataConfig = $product->getDataConfig();
$typeId = isset($dataConfig['type_id']) ? $dataConfig['type_id'] : null;
/** @var CatalogProductSimple $product */
if ($this->hasRender($typeId)) {
$this->callRender($typeId, 'fillOptions', ['product' => $product]);
} else {
$optionsCheckoutData = [];
if ($product instanceof InjectableFixture) {
/** @var CatalogProductSimple $product */
$customOptions = $product->hasData('custom_options') ? $product->getDataFieldConfig('custom_options')['source']->getCustomOptions() : [];
$checkoutData = $product->getCheckoutData();
$productCheckoutData = isset($checkoutData['custom_options']) ? $checkoutData['custom_options'] : [];
$optionsCheckoutData = $this->prepareCheckoutData($customOptions, $productCheckoutData);
}
$this->getCustomOptionsBlock()->fillCustomOptions($optionsCheckoutData);
}
}
示例9: fill
/**
* Fill the product form
*
* @param FixtureInterface $product
* @param Element|null $element [optional]
* @param FixtureInterface|null $category [optional]
* @return FormTabs
*/
public function fill(FixtureInterface $product, Element $element = null, FixtureInterface $category = null)
{
$dataConfig = $product->getDataConfig();
$typeId = isset($dataConfig['type_id']) ? $dataConfig['type_id'] : null;
if ($this->hasRender($typeId)) {
$renderArguments = ['product' => $product, 'element' => $element, 'category' => $category];
$this->callRender($typeId, 'fill', $renderArguments);
} else {
$tabs = $this->getFieldsByTabs($product);
if (null === $category && $product instanceof DataFixture) {
$categories = $product->getCategories();
$category = reset($categories);
}
if ($category) {
$tabs['product-details']['category_ids']['value'] = $category instanceof InjectableFixture ? $category->getName() : $category->getCategoryName();
}
$this->showAdvancedSettings();
$this->fillTabs($tabs, $element);
}
return $this;
}
示例10: persist
/**
* Create category
*
* @param FixtureInterface $fixture [optional]
* @return int|null
*/
public function persist(FixtureInterface $fixture = null)
{
$config = $fixture->getDataConfig();
$parentCategory = $fixture->getData('category_path/input_value');
$url = $this->_getUrl($config, $parentCategory);
$prefix = isset($config['input_prefix']) ? $config['input_prefix'] : null;
$params = $this->_prepareData($fixture->getData('fields'), $prefix);
$curl = new BackendDecorator(new CurlTransport(), new Config());
$curl->write(CurlInterface::POST, $url, '1.0', array(), $params);
$response = $curl->read();
$curl->close();
preg_match("~.+\\/id\\/(\\d+)\\/.+~", $response, $matches);
return isset($matches[1]) ? $matches[1] : null;
}
示例11: persist
/**
* POST request for creating downloadable product
*
* @param FixtureInterface $fixture [optional]
* @return int id of created product
*/
public function persist(FixtureInterface $fixture = null)
{
$config = $fixture->getDataConfig();
$curl = new BackendDecorator(new CurlTransport(), new Config());
$curl->addOption(CURLOPT_HEADER, 1);
$curl->write(CurlInterface::POST, $this->getUrl($config), '1.0', [], $this->prepareData($fixture->getData('fields'), isset($config['input_prefix']) ? $config['input_prefix'] : null));
$response = $curl->read();
$curl->close();
preg_match("~Location: [^\\s]*\\/id\\/(\\d+)~", $response, $matches);
return $matches[1];
}