• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mtf\ObjectManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

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


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


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


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


示例5: __construct

 /**
  * @construct
  * @param array $params
  * @param string $data
  */
 public function __construct(array $params, $data = '')
 {
     $this->params = $params;
     /** @var \Magento\Mtf\Config\DataInterface $systemConfig */
     if ($data == '%current_password%') {
         $systemConfig = ObjectManager::getInstance()->create('Magento\\Mtf\\Config\\DataInterface');
         $data = $systemConfig->get('application/0/backendPassword/0/value');
     }
     $this->data = $data;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:CurrentPassword.php


示例6: __construct

 /**
  * @constructor
  * @param array $params
  * @param array $data
  */
 public function __construct(array $params, array $data = [])
 {
     $this->params = $params;
     $this->products = isset($data['products']) ? $data['products'] : [];
     foreach ($this->products as $product) {
         $classItem = 'Magento\\' . $this->getModuleName($product) . '\\Test\\Fixture\\Cart\\Item';
         $item = ObjectManager::getInstance()->create($classItem, ['product' => $product]);
         $this->data[] = $item;
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:Items.php


示例7: prepareData

 /**
  * Prepare data
  *
  * @param array $viewsReport
  * @return array
  */
 protected function prepareData(array $viewsReport)
 {
     foreach ($viewsReport as $key => $reportFilter) {
         if (in_array($key, $this->dateFields)) {
             $date = ObjectManager::getInstance()->create('\\Magento\\Backend\\Test\\Fixture\\Source\\Date', ['params' => [], 'data' => ['pattern' => $reportFilter]]);
             $viewsReport[$key] = $date->getData();
         }
     }
     return $viewsReport;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:16,代码来源:AbstractFilter.php


示例8: open

 /**
  * Open backend page and log in if needed.
  *
  * @param array $params
  * @return $this
  */
 public function open(array $params = [])
 {
     $systemConfig = ObjectManager::getInstance()->create('Magento\\Mtf\\Config\\DataInterface');
     $admin = ['username' => ['value' => $systemConfig->get('application/0/backendLogin/0/value')], 'password' => ['value' => $systemConfig->get('application/0/backendPassword/0/value')]];
     $this->adminAuthLogin = ObjectManager::getInstance()->create('Mage\\Adminhtml\\Test\\Page\\AdminAuthLogin');
     $this->dashboard = ObjectManager::getInstance()->create('Mage\\Adminhtml\\Test\\Page\\Adminhtml\\Dashboard');
     if (!$this->dashboard->getAdminPanelHeader()->isVisible()) {
         $this->loginSuperAdmin($admin);
     }
     return parent::open($params);
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:17,代码来源:BackendPage.php


示例9: prepareData

 /**
  * Prepare data
  *
  * @param array $customersReport
  * @return array
  */
 protected function prepareData(array $customersReport)
 {
     foreach ($customersReport as $name => $reportFilter) {
         if ($name === 'report_period') {
             continue;
         }
         $date = ObjectManager::getInstance()->create('\\Magento\\Backend\\Test\\Fixture\\Source\\Date', ['params' => [], 'data' => ['pattern' => $reportFilter]]);
         $customersReport[$name] = $date->getData();
     }
     return $customersReport;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:Grid.php


示例10: processAssert

 /**
  * Check that checkbox is present on the last checkout step - Order Review.
  * Check that after Place order without click on checkbox "Terms and Conditions" order was not successfully placed.
  * Check that after clicking on "Terms and Conditions" checkbox and "Place Order" button success place order message
  * appears.
  *
  * @param FixtureFactory $fixtureFactory
  * @param ObjectManager $objectManager
  * @param string $product
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param CheckoutOnepage $checkoutOnepage
  * @param CheckoutOnepageSuccess $checkoutOnepageSuccess
  * @param AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage
  * @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, CheckoutOnepageSuccess $checkoutOnepageSuccess, AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage, $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);
     $checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
     \PHPUnit_Framework_Assert::assertEquals(self::NOTIFICATION_MESSAGE, $checkoutOnepage->getAgreementReview()->getNotificationMassage(), 'Notification required message of Terms and Conditions is absent.');
     $checkoutOnepage->getAgreementReview()->setAgreement('Yes');
     $checkoutOnepage->getAgreementReview()->placeOrder();
     $assertOrderSuccessPlacedMessage->processAssert($checkoutOnepageSuccess);
 }
开发者ID:nja78,项目名称:magento2,代码行数:43,代码来源:AssertTermOnCheckout.php


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


示例12: processAssert

 /**
  * Check that checkbox is present on the last checkout step - Order Review.
  * Check that after Place order without click on checkbox "Terms and Conditions" order was not successfully placed.
  * Check that after clicking on "Terms and Conditions" checkbox and "Place Order" button success place order message
  * appears.
  *
  * @param ObjectManager $objectManager
  * @param string $products
  * @param CheckoutOnepage $checkoutOnepage
  * @param CheckoutOnepageSuccess $checkoutOnepageSuccess
  * @param AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage
  * @param array $shipping
  * @param array $payment
  * @param CheckoutAgreement $agreement
  * @return void
  */
 public function processAssert(ObjectManager $objectManager, $products, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, AssertOrderSuccessPlacedMessage $assertOrderSuccessPlacedMessage, $shipping, $payment, CheckoutAgreement $agreement)
 {
     $paymentBlock = $checkoutOnepage->getPaymentBlock();
     $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();
     $paymentBlock->getSelectedPaymentMethodBlock()->clickPlaceOrder();
     \PHPUnit_Framework_Assert::assertEquals(self::NOTIFICATION_MESSAGE, $checkoutOnepage->getAgreementReview()->getNotificationMassage(), 'Notification required message of Terms and Conditions is absent.');
     $checkoutOnepage->getAgreementReview()->setAgreement('Yes', $agreement);
     $paymentBlock->getSelectedPaymentMethodBlock()->clickPlaceOrder();
     $assertOrderSuccessPlacedMessage->processAssert($checkoutOnepageSuccess);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:35,代码来源:AssertTermOnCheckout.php


示例13: addToCart

 /**
  * Add products to cart
  *
  * @param array $products
  * @return void
  */
 protected function addToCart(array $products)
 {
     $addToCartStep = ObjectManager::getInstance()->create('Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', ['products' => $products]);
     $addToCartStep->run();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:DeleteProductFromMiniShoppingCartTest.php


示例14: tearDownAfterClass

 /**
  * Delete all tax rules after test.
  *
  * @return void
  */
 public static function tearDownAfterClass()
 {
     ObjectManager::getInstance()->create('Mage\\Tax\\Test\\TestStep\\DeleteAllTaxRulesStep')->run();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:9,代码来源:CreateOrderWithPayPalStandardTest.php


示例15: loginCustomer

 /**
  * Login customer to frontend.
  *
  * @param Customer $customer
  * @return void
  */
 public function loginCustomer(Customer $customer)
 {
     $loginCustomerOnFrontendStep = ObjectManager::getInstance()->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer]);
     $loginCustomerOnFrontendStep->run();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:11,代码来源:FrontendActionsForCustomer.php


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


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


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


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


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Client\Browser类代码示例发布时间:2022-05-23
下一篇:
PHP Result\PageFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap