当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectManager::create方法代码示例

本文整理汇总了PHP中Magento\Mtf\ObjectManager::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManager::create方法的具体用法?PHP ObjectManager::create怎么用?PHP ObjectManager::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Mtf\ObjectManager的用法示例。


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

示例1: apply

 /**
  * Apply set up configuration profile.
  *
  * @return void
  */
 public function apply()
 {
     parent::apply();
     if (file_exists(dirname(dirname(dirname(MTF_BP))) . '/app/etc/config.php')) {
         $this->objectManager->create('\\Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->config])->run();
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:State1.php

示例2: run

 /**
  * Fill customer addresses and proceed to next step.
  *
  * @return void
  */
 public function run()
 {
     $addresses = $this->customer->getDataFieldConfig('address')['source']->getAddresses();
     $bindings = [];
     foreach ($this->products as $key => $product) {
         $productName = $product->getName();
         $addressRender = $this->objectManager->create(\Magento\Customer\Test\Block\Address\Renderer::class, ['address' => $addresses[$key], 'type' => 'oneline']);
         $bindings[$productName] = $addressRender->render();
     }
     $this->addresses->getAddressesBlock()->selectAddresses($bindings);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:FillCustomerAddressesStep.php

示例3: run

 /**
  * Review order contents and place order.
  *
  * @return array
  */
 public function run()
 {
     $this->orderReviewExpress->getReviewBlock()->selectShippingMethod($this->shipping);
     foreach ($this->prices as $priceName => $value) {
         $assertName = 'Assert' . ucfirst($priceName) . 'OrderReview';
         $assert = $this->objectManager->create('Magento\\Checkout\\Test\\Constraint\\' . $assertName);
         $assert->processAssert($this->checkoutOnepage, $value);
     }
     $this->orderReviewExpress->getReviewBlock()->placeOrder();
     return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId()];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:ExpressCheckoutOrderPlaceStep.php

示例4: run

 /**
  * Run a Mtf application
  *
  * @param $applicationName
  * @param array $arguments
  * @return mixed
  * @throws \DomainException
  */
 public function run($applicationName, array $arguments = [])
 {
     try {
         if (!$this->_locator) {
             $locatorFactory = new \Magento\Mtf\ObjectManagerFactory();
             $this->_locator = $locatorFactory->create();
         }
         return $this->_locator->create($applicationName, $arguments)->launch();
     } catch (\Exception $exception) {
         $message = "Error happened during application run.\n";
         $message .= $exception->getMessage();
         throw new \DomainException($message);
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:EntryPoint.php

示例5: run

 /**
  * @inheritdoc
  *
  * @return array
  */
 public function run()
 {
     $this->objectManager->create(\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep::class, ['customer' => $this->customer])->run();
     $this->customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Credit Cards');
     $myCreditCardsBlock = $this->myCreditCardsPage->getCreditCardsBlock();
     $creditCardData = $this->creditCard->getData();
     $creditCardNumber = preg_grep('/([a-z]+)_number/', array_flip($creditCardData));
     $lastFourDigits = substr(key($creditCardNumber), -4, 4);
     $availableCreditCards = $myCreditCardsBlock->getCreditCards();
     if (key_exists($lastFourDigits, $availableCreditCards)) {
         $myCreditCardsBlock->deleteCreditCard($availableCreditCards[$lastFourDigits]);
     }
     $this->assertCreditCardDeletedMessage->processAssert($this->myCreditCardsPage);
     return ['deletedCreditCard' => $lastFourDigits];
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:20,代码来源:DeleteCreditCardFromMyAccountStep.php

示例6: processCheckout

 /**
  * Process checkout.
  *
  * @param string $checkoutMethod
  * @param Address $billingAddress
  * @param array $shipping
  * @param array $payment
  * @return void
  */
 protected function processCheckout($checkoutMethod, Address $billingAddress, array $shipping, array $payment)
 {
     $this->objectManager->create('Mage\\Checkout\\Test\\TestStep\\SelectCheckoutMethodStep', ['checkoutMethod' => $checkoutMethod])->run();
     $this->objectManager->create('Mage\\Checkout\\Test\\TestStep\\FillBillingInformationStep', ['billingAddress' => $billingAddress])->run();
     $this->objectManager->create('Mage\\Checkout\\Test\\TestStep\\FillShippingMethodStep', ['shipping' => $shipping])->run();
     $this->objectManager->create('Mage\\Checkout\\Test\\TestStep\\SelectPaymentMethodStep', ['payment' => $payment])->run();
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:16,代码来源:AssertTermOnCheckout.php

示例7: processAssert

 /**
  * Assert order is not visible in customer account on frontend
  *
  * @param OrderInjectable $order
  * @param Customer $customer
  * @param ObjectManager $objectManager
  * @param CustomerAccountIndex $customerAccountIndex
  * @param OrderHistory $orderHistory
  * @param string $status
  * @return void
  */
 public function processAssert(OrderInjectable $order, Customer $customer, ObjectManager $objectManager, CustomerAccountIndex $customerAccountIndex, OrderHistory $orderHistory, $status)
 {
     $filter = ['id' => $order->getId(), 'status' => $status];
     $customerLogin = $objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer]);
     $customerLogin->run();
     $customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Orders');
     \PHPUnit_Framework_Assert::assertFalse($orderHistory->getOrderHistoryBlock()->isOrderVisible($filter), 'Order with following data \'' . implode(', ', $filter) . '\' is present in Orders block on frontend.');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:AssertOrderNotVisibleOnMyAccount.php

示例8: createProducts

 /**
  * Create products.
  *
  * @param array $products
  * @return array
  */
 protected function createProducts(array $products)
 {
     $resultProduct = [];
     foreach ($products as $key => $product) {
         $resultProduct[$key] = $this->objectManager->create('Mage\\Catalog\\Test\\TestStep\\CreateProductsStep', ['products' => implode(',', $product)])->run()['products'];
     }
     return $resultProduct;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:14,代码来源:BundleSelections.php

示例9: processAssert

 /**
  * Assert that order is present in Orders grid on frontend.
  *
  * @param OrderInjectable $order
  * @param Customer $customer
  * @param ObjectManager $objectManager
  * @param CustomerAccountIndex $customerAccountIndex
  * @param OrderHistory $orderHistory
  * @param string $status
  * @param string $orderId
  * @param string|null $statusToCheck
  * @return void
  */
 public function processAssert(OrderInjectable $order, Customer $customer, ObjectManager $objectManager, CustomerAccountIndex $customerAccountIndex, OrderHistory $orderHistory, $status, $orderId = '', $statusToCheck = null)
 {
     $filter = ['id' => $order->hasData('id') ? $order->getId() : $orderId, 'status' => $statusToCheck === null ? $status : $statusToCheck];
     $objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Orders');
     $errorMessage = implode(', ', $filter);
     \PHPUnit_Framework_Assert::assertTrue($orderHistory->getOrderHistoryBlock()->isOrderVisible($filter), 'Order with following data \'' . $errorMessage . '\' is absent in Orders block on frontend.');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:21,代码来源:AssertOrderInOrdersGridOnFrontend.php

示例10: run

 /**
  * Review order contents and place order.
  *
  * @return array
  */
 public function run()
 {
     $this->orderReviewExpress->getReviewBlock()->selectShippingMethod($this->shipping);
     foreach ($this->prices as $priceName => $value) {
         $assertName = 'Assert' . ucfirst($priceName) . 'OrderReview';
         $assert = $this->objectManager->create('Magento\\Checkout\\Test\\Constraint\\' . $assertName);
         $assert->processAssert($this->checkoutOnepage, $value);
     }
     $this->orderReviewExpress->getReviewBlock()->placeOrder();
     $order = $this->fixtureFactory->createByCode('orderInjectable', ['data' => ['entity_id' => ['products' => $this->products]]]);
     return ['orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(), 'order' => $order];
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:17,代码来源:ExpressCheckoutOrderPlaceStep.php

示例11: deleteCustomerAddress

 /**
  * Click delete customer address button.
  *
  * @param Address $addressToDelete
  * @return $this
  */
 public function deleteCustomerAddress(Address $addressToDelete)
 {
     $addressRenderer = $this->objectManager->create(\Magento\Customer\Test\Block\Address\Renderer::class, ['address' => $addressToDelete, 'type' => 'html']);
     $addressToDelete = $addressRenderer->render();
     $dataList = explode("\n", $addressToDelete);
     $dataList = implode("') and contains(.,'", $dataList);
     $this->_rootElement->find(sprintf($this->addressSelector, $dataList), Locator::SELECTOR_XPATH)->find($this->deleteAddress)->click();
     $element = $this->browser->find($this->confirmModal);
     /** @var \Magento\Ui\Test\Block\Adminhtml\Modal $modal */
     $modal = $this->blockFactory->create(\Magento\Ui\Test\Block\Adminhtml\Modal::class, ['element' => $element]);
     $modal->acceptAlert();
     return $this;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:19,代码来源:Addresses.php

示例12: processAssert

 /**
  * Place order and verify there is no checkbox Terms and Conditions.
  *
  * @param FixtureFactory $fixtureFactory
  * @param ObjectManager $objectManager
  * @param string $product
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param CheckoutOnepage $checkoutOnepage
  * @param CheckoutAgreement $agreement
  * @param array $shipping
  * @param array $payment
  * @return void
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(FixtureFactory $fixtureFactory, ObjectManager $objectManager, $product, BrowserInterface $browser, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutAgreement $agreement, $shipping, $payment)
 {
     $createProductsStep = $objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', ['products' => $product]);
     $product = $createProductsStep->run();
     $billingAddress = $fixtureFactory->createByCode('address', ['dataset' => 'default']);
     $browser->open($_ENV['app_frontend_url'] . $product['products'][0]->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCartButton();
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $checkoutCart->getCartBlock()->getOnepageLinkBlock()->proceedToCheckout();
     $checkoutOnepage->getLoginBlock()->clickContinue();
     $checkoutOnepage->getBillingBlock()->fill($billingAddress);
     $checkoutOnepage->getBillingBlock()->clickContinue();
     $checkoutOnepage->getShippingMethodBlock()->selectShippingMethod($shipping);
     $checkoutOnepage->getShippingMethodBlock()->clickContinue();
     $checkoutOnepage->getPaymentBlock()->selectPaymentMethod($payment);
     \PHPUnit_Framework_Assert::assertFalse($checkoutOnepage->getAgreementReview()->checkAgreement($agreement), 'Checkout Agreement \'' . $agreement->getName() . '\' is present in the Place order step.');
 }
开发者ID:nja78,项目名称:magento2,代码行数:35,代码来源:AssertTermAbsentOnCheckout.php

示例13: setConfiguration

 /**
  * Set integration data to configuration file.
  *
  * @param Integration $integration
  * @return void
  */
 protected function setConfiguration(Integration $integration)
 {
     $fileConfig = MTF_BP . '/etc/config.xml';
     $dom = new \DOMDocument();
     if (!file_exists($fileConfig)) {
         copy(MTF_BP . '/etc/config.xml.dist', $fileConfig);
     }
     $dom->load($fileConfig);
     $webapiToken = (new \DOMXPath($dom))->query('//config/handler/webapi/token')->item(0);
     if ($webapiToken) {
         $webapiToken->nodeValue = $integration->getToken();
     } else {
         $webapi = (new \DOMXPath($dom))->query('//config/handler/webapi')->item(0);
         $webapi->appendChild($dom->createElement('token', $integration->getToken()));
     }
     $dom->save($fileConfig);
     $this->configuration = $this->objectManager->create('Magento\\Mtf\\Config\\DataInterface');
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:24,代码来源:WebapiDecorator.php

示例14: processAssert

 /**
  * Verify Terms and Conditions checkbox is absent on checkout page.
  *
  * @param ObjectManager $objectManager
  * @param $products
  * @param CheckoutOnepage $checkoutOnepage
  * @param $shipping
  * @param $payment
  * @param CheckoutAgreement $agreement
  *
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function processAssert(ObjectManager $objectManager, $products, CheckoutOnepage $checkoutOnepage, $shipping, $payment, CheckoutAgreement $agreement)
 {
     $shippingAddressData = ['shippingAddress' => ['dataSet' => 'US_address_1']];
     $productsData = ['products' => $products];
     $shippingMethodData = ['shipping' => $shipping];
     $paymentData = ['payment' => $payment];
     $products = $objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductsStep', $productsData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', $products)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\ProceedToCheckoutStep')->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\FillShippingAddressStep', $shippingAddressData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\FillShippingMethodStep', $shippingMethodData)->run();
     $objectManager->create('Magento\\Checkout\\Test\\TestStep\\SelectPaymentMethodStep', $paymentData)->run();
     \PHPUnit_Framework_Assert::assertFalse($checkoutOnepage->getAgreementReview()->checkAgreement($agreement), 'Checkout Agreement \'' . $agreement->getName() . '\' is present in the Place order step.');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:26,代码来源:AssertTermAbsentOnCheckout.php

示例15: find

 /**
  * Find element on the page
  *
  * @param string $selector
  * @param string $strategy
  * @param string $type = select|multiselect|checkbox|null OR custom class with full namespace
  * @param ElementInterface $context
  * @return ElementInterface
  * @throws \Exception
  */
 public function find($selector, $strategy = Locator::SELECTOR_CSS, $type = null, ElementInterface $context = null)
 {
     $locator = new Locator($selector, $strategy);
     $this->eventManager->dispatchEvent(['find'], [__METHOD__, $locator]);
     $className = 'Magento\\Mtf\\Client\\ElementInterface';
     if (null !== $type) {
         if (strpos($type, '\\') === false) {
             $type = ucfirst(strtolower($type));
             if (class_exists('Magento\\Mtf\\Client\\Element\\' . $type . 'Element')) {
                 $className = 'Magento\\Mtf\\Client\\Element\\' . $type . 'Element';
             }
         } else {
             if (!class_exists($type) && !interface_exists($type)) {
                 throw new \Exception(sprintf('Requested interface or class "%s" does not exists!', $type));
             }
             $className = $type;
         }
     }
     return $this->objectManager->create($className, ['driver' => $this, 'locator' => $locator, 'context' => $context]);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:30,代码来源:Driver.php


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