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


PHP FixtureFactory::createByCode方法代碼示例

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


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

示例1: fillGiftMessageOrder

 /**
  * Fill gift message form on order level
  *
  * @param GiftMessage $giftMessage
  * @return void
  */
 public function fillGiftMessageOrder(GiftMessage $giftMessage)
 {
     /** @var \Magento\GiftMessage\Test\Block\Cart\GiftOptions\GiftMessageForm $giftMessageForm */
     if ($giftMessage->getAllowGiftMessagesForOrder() === 'Yes') {
         $this->_rootElement->find($this->allowGiftOptions)->click();
         $giftMessageForm = $this->blockFactory->create('Magento\\GiftMessage\\Test\\Block\\Cart\\GiftOptions\\GiftMessageForm', ['element' => $this->_rootElement->find($this->giftMessageOrderForm)]);
         $formData = ['sender' => $giftMessage->getSender(), 'recipient' => $giftMessage->getRecipient(), 'message' => $giftMessage->getMessage()];
         $formData = $this->fixtureFactory->createByCode('giftMessage', ['data' => $formData]);
         $giftMessageForm->fill($formData);
         $this->_rootElement->find($this->giftMessageOrderButton)->click();
         $this->waitForElementVisible($this->giftMessageSummary);
     }
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:19,代碼來源:GiftOptions.php

示例2: run

 /**
  * Create new order via curl.
  *
  * @return array
  */
 public function run()
 {
     /** @var Order $order */
     $order = $this->fixtureFactory->createByCode('order', ['dataSet' => $this->orderDataSet]);
     $order->persist();
     return ['order' => $order];
 }
開發者ID:chucky515,項目名稱:Magento-CE-Mirror,代碼行數:12,代碼來源:CreateNewOrderViaCurlStep.php

示例3: __construct

 /**
  * @constructor
  * @param FixtureFactory $fixtureFactory
  * @param string $data
  * @param array $params [optional]
  */
 public function __construct(FixtureFactory $fixtureFactory, $data, array $params = [])
 {
     $this->params = $params;
     $explodedData = explode('::', $data);
     switch (sizeof($explodedData)) {
         case 1:
             $this->data = $explodedData[0];
             break;
         case 3:
             list($fixture, $dataset, $field) = $explodedData;
             $entity = $fixtureFactory->createByCode($fixture, ['dataset' => $dataset]);
             if (!$entity->hasData('id')) {
                 $entity->persist();
             }
             $this->data = $entity->getData($field);
             $this->entity = $entity;
             break;
         case 4:
             list($fixture, $dataset, $source, $field) = $explodedData;
             $entity = $fixtureFactory->createByCode($fixture, ['dataset' => $dataset]);
             if (!$entity->hasData('id')) {
                 $entity->persist();
             }
             $source = $source == 'product' ? $entity->getEntityId()['products'][0] : $entity->getData($source);
             $this->data = $source->getData($field);
             $this->entity = $entity;
             break;
     }
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:35,代碼來源:Query.php

示例4: run

 /**
  * Fill Sales Data.
  *
  * @return array
  */
 public function run()
 {
     $this->orderCreateIndex->getCreateBlock()->submitOrder();
     $this->salesOrderView->getMessagesBlock()->waitSuccessMessage();
     $orderId = trim($this->salesOrderView->getTitleBlock()->getTitle(), '#');
     $order = $this->fixtureFactory->createByCode('orderInjectable', ['data' => ['id' => $orderId, 'customer_id' => ['customer' => $this->customer], 'entity_id' => ['products' => $this->products], 'billing_address_id' => ['billingAddress' => $this->billingAddress]]]);
     return ['orderId' => $orderId, 'order' => $order];
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:13,代碼來源:SubmitOrderStep.php

示例5: prepareVatConfig

 /**
  * Prepare VAT ID confguration.
  *
  * @param ConfigData $vatConfig
  * @param string $customerGroup
  * @return void
  */
 protected function prepareVatConfig(ConfigData $vatConfig, $customerGroup)
 {
     $groupConfig = ['customer/create_account/viv_domestic_group' => ['value' => $this->vatGroups['valid_domestic_group']->getCustomerGroupId()], 'customer/create_account/viv_intra_union_group' => ['value' => $this->vatGroups['valid_intra_union_group']->getCustomerGroupId()], 'customer/create_account/viv_invalid_group' => ['value' => $this->vatGroups['invalid_group']->getCustomerGroupId()], 'customer/create_account/viv_error_group' => ['value' => $this->vatGroups['error_group']->getCustomerGroupId()]];
     $vatConfig = $this->fixtureFactory->createByCode('configData', ['data' => array_replace_recursive($vatConfig->getSection(), $groupConfig)]);
     $vatConfig->persist();
     $customerData = array_merge($this->customer->getData(), ['group_id' => ['value' => $this->vatGroups[$customerGroup]->getCustomerGroupCode()]], ['address' => ['addresses' => $this->customer->getDataFieldConfig('address')['source']->getAddresses()]]);
     $this->customer = $this->fixtureFactory->createByCode('customer', ['data' => $customerData]);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:15,代碼來源:AbstractApplyVatIdTest.php

示例6: test

 /**
  * Update CMS Page.
  *
  * @param CmsPage $cms
  * @param CmsPage $cmsOriginal
  * @return array
  */
 public function test(CmsPage $cms, CmsPage $cmsOriginal)
 {
     // Steps
     $this->cmsPageIndex->open();
     $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsOriginal->getTitle()]);
     $this->cmsPageNew->getPageForm()->fill($cms);
     $this->cmsPageNew->getPageMainActions()->save();
     return ['cms' => $this->factory->createByCode('cmsPage', ['data' => array_merge($cmsOriginal->getData(), $cms->getData())])];
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:16,代碼來源:UpdateCmsPageEntityTest.php

示例7: run

 /**
  * Create reward exchange rates.
  *
  * @return void
  */
 public function run()
 {
     if (count($this->rewardRates)) {
         foreach ($this->rewardRates as $rewardRate) {
             $exchangeRate = $this->fixtureFactory->createByCode('rewardRate', ['dataSet' => $rewardRate]);
             $exchangeRate->persist();
         }
     }
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:14,代碼來源:CreateRewardExchangeRatesStep.php

示例8: run

 /**
  * Place order after checking order totals on review step.
  *
  * @return array
  */
 public function run()
 {
     if (isset($this->prices['grandTotal'])) {
         $this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']);
     }
     $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
     $order = $this->fixtureFactory->createByCode('orderInjectable', ['data' => ['entity_id' => ['products' => $this->products]]]);
     return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(), 'order' => $order];
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:14,代碼來源:PlaceOrderStep.php

示例9: run

 /**
  * Set Default Attribute Value.
  *
  * @return void
  */
 public function run()
 {
     $customAttribute = $this->attribute;
     if ($this->attributeValue !== null) {
         $customAttribute = ['value' => $this->attributeValue, 'attribute' => $customAttribute];
     }
     $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['data' => ['custom_attribute' => $customAttribute]]);
     $this->catalogProductEdit->getProductForm()->fill($product);
 }
開發者ID:Zash22,項目名稱:magento,代碼行數:14,代碼來源:SetDefaultAttributeValueStep.php

示例10: __inject

 /**
  * Create simple product and inject pages.
  *
  * @param SystemCurrencySymbolIndex $currencySymbolIndex
  * @param SystemCurrencyIndex $currencyIndex
  * @param FixtureFactory $fixtureFactory
  * @return array
  */
 public function __inject(SystemCurrencySymbolIndex $currencySymbolIndex, SystemCurrencyIndex $currencyIndex, FixtureFactory $fixtureFactory)
 {
     $this->currencySymbolIndex = $currencySymbolIndex;
     $this->currencyIndex = $currencyIndex;
     $this->fixtureFactory = $fixtureFactory;
     $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'product_with_category']);
     $product->persist();
     return ['product' => $product];
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:17,代碼來源:AbstractCurrencySymbolEntityTest.php

示例11: run

 /**
  * Create sales rule.
  *
  * @return array
  */
 public function run()
 {
     $result['salesRule'] = null;
     if ($this->salesRule !== null) {
         $salesRule = $this->fixtureFactory->createByCode('salesRule', ['dataset' => $this->salesRule]);
         $salesRule->persist();
         $result['salesRule'] = $salesRule;
     }
     return $result;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:15,代碼來源:CreateSalesRuleStep.php

示例12: __prepare

 /**
  * Prepare data.
  *
  * @param FixtureFactory $fixtureFactory
  * @return array
  */
 public function __prepare(FixtureFactory $fixtureFactory)
 {
     /** @var CatalogProductSimple $productSymbols */
     $productSymbols = $fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'abc_dfj_simple_for_advancedsearch']);
     $productSymbols->persist();
     /** @var CatalogProductSimple $productNumbers */
     $productNumbers = $fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'adc_123_simple_for_advancedsearch']);
     $productNumbers->persist();
     return ['productsSearch' => ['simple_1' => $productSymbols, 'simple_2' => $productNumbers]];
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:16,代碼來源:AdvancedSearchEntityTest.php

示例13: run

 /**
  * Create product.
  *
  * @return array
  */
 public function run()
 {
     list($fixtureClass, $dataSet) = explode('::', $this->product);
     /** @var FixtureInterface $product */
     $product = $this->fixtureFactory->createByCode(trim($fixtureClass), ['dataSet' => trim($dataSet), 'data' => $this->data]);
     if ($product->hasData('id') === false) {
         $product->persist();
     }
     return ['product' => $product];
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:15,代碼來源:CreateProductStep.php

示例14: run

 /**
  * Create tax rule.
  *
  * @return array
  */
 public function run()
 {
     $result['taxRule'] = null;
     if ($this->taxRule != '-') {
         $taxRule = $this->fixtureFactory->createByCode('taxRule', ['dataSet' => $this->taxRule]);
         $taxRule->persist();
         $result['taxRule'] = $taxRule;
     }
     return $result;
 }
開發者ID:chucky515,項目名稱:Magento-CE-Mirror,代碼行數:15,代碼來源:CreateTaxRuleStep.php

示例15: __prepare

 /**
  * Create customer and 2 simple products with categories before run test.
  *
  * @param FixtureFactory $fixtureFactory
  * @return array
  */
 public function __prepare(FixtureFactory $fixtureFactory)
 {
     $customer = $fixtureFactory->createByCode('customer', ['dataset' => 'default']);
     $customer->persist();
     $productForSalesRule1 = $fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'simple_for_salesrule_1']);
     $productForSalesRule1->persist();
     $productForSalesRule2 = $fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'simple_for_salesrule_2']);
     $productForSalesRule2->persist();
     return ['customer' => $customer, 'productForSalesRule1' => $productForSalesRule1, 'productForSalesRule2' => $productForSalesRule2];
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:16,代碼來源:CreateSalesRuleEntityTest.php


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