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


PHP ObjectManager::getInstance方法代码示例

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


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

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

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

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

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

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

示例6: getClassBlock

 /**
  * Get block by class.
  *
  * @param string $class
  * @return mixed
  */
 protected function getClassBlock($class)
 {
     return \Magento\Mtf\ObjectManager::getInstance()->create($class, ['element' => $this->find($this->selectBlock, Locator::SELECTOR_XPATH)]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:ChosenOption.php

示例7: tearDownAfterClass

 /**
  * Setup default configuration after test.
  *
  * @return void
  */
 public static function tearDownAfterClass()
 {
     $objectManager = ObjectManager::getInstance();
     $objectManager->create('Mage\\Core\\Test\\TestStep\\SetupConfigurationStep', ['configData' => 'default_tax_configuration'])->run();
     $objectManager->create('Mage\\Core\\Test\\TestStep\\SetupConfigurationStep', ['configData' => 'shipping_tax_class_taxable_goods', 'rollback' => true])->run();
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:11,代码来源:TaxCalculationTest.php

示例8: createNewVariationSet

 /**
  * Create new variation set.
  *
  * @param array $attribute
  * @return void
  */
 protected function createNewVariationSet(array $attribute)
 {
     $attributeFixture = ObjectManager::getInstance()->create('Magento\\Catalog\\Test\\Fixture\\CatalogProductAttribute', ['data' => $attribute]);
     $this->browser->find($this->createNewVariationSet)->click();
     $this->getEditAttributeForm()->fill($attributeFixture);
     $this->getEditAttributeForm()->saveAttributeForm();
     $this->waitBlock($this->newAttributeFrame);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:14,代码来源:Attribute.php

示例9: tearDownAfterClass

 /**
  * Rollback default configuration.
  *
  * @return void
  */
 public static function tearDownAfterClass()
 {
     $objectManager = ObjectManager::getInstance();
     $objectManager->create('Mage\\Core\\Test\\TestStep\\SetupConfigurationStep', ['configData' => 'default_tax_configuration'])->run();
     $objectManager->create('\\Mage\\Tax\\Test\\TestStep\\CreateTaxRuleStep', ['taxRule' => 'default'])->run();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:11,代码来源:TaxWithCrossBorderTest.php

示例10: getCartItemClass

 /**
  * Get module name from fixture.
  *
  * @param FixtureInterface $product
  * @return string
  */
 protected function getCartItemClass(FixtureInterface $product)
 {
     $typeId = $product->getDataConfig()['type_id'];
     return ObjectManager::getInstance()->create($this->itemRender[$typeId], ['product' => $product]);
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:11,代码来源:Items.php

示例11: tearDown

 /**
  * Delete attribute after test.
  *
  * @return void
  */
 public function tearDown()
 {
     ObjectManager::getInstance()->create('Magento\\Catalog\\Test\\TestStep\\DeleteAttributeStep', ['attribute' => $this->attribute])->run();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:9,代码来源:CreateProductAttributeEntityFromProductPageTest.php

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

示例13: fillCondition

 /**
  * Fill single condition
  *
  * @param array $rules
  * @param ElementInterface $element
  * @return void
  * @throws \Exception
  */
 protected function fillCondition(array $rules, ElementInterface $element)
 {
     $this->resetKeyParam();
     foreach ($rules as $rule) {
         /** @var ElementInterface $param */
         $param = $this->findNextParam($element);
         $this->driver->selectWindow();
         $param->find('a')->click();
         if (preg_match('`%(.*?)%`', $rule, $chooserGrid)) {
             $chooserConfig = explode('#', $chooserGrid[1]);
             $param->find($this->chooserLocator)->click();
             $rule = preg_replace('`%(.*?)%`', '', $rule);
             $grid = ObjectManager::getInstance()->create(str_replace('/', '\\', $chooserConfig[0]), ['element' => $this->find($this->chooserGridLocator)]);
             $grid->searchAndSelect([$chooserConfig[1] => $rule]);
             continue;
         }
         $input = $this->ruleParamInput;
         $param->waitUntil(function () use($param, $input) {
             $element = $param->find($input);
             return $element->isVisible() ? true : null;
         });
         $value = $param->find('select', Locator::SELECTOR_TAG_NAME, 'select');
         if ($value->isVisible()) {
             $value->setValue($rule);
             $this->click();
             continue;
         }
         $value = $param->find('input', Locator::SELECTOR_TAG_NAME);
         if ($value->isVisible()) {
             $value->setValue($rule);
             $apply = $param->find('.//*[@class="rule-param-apply"]', Locator::SELECTOR_XPATH);
             if ($apply->isVisible()) {
                 $apply->click();
             }
             continue;
         }
         throw new \Exception('Undefined type of value ');
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:47,代码来源:ConditionsElement.php

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

示例15: getTemplateBlock

 /**
  * Get backend abstract block.
  *
  * @return Template
  */
 protected function getTemplateBlock()
 {
     return ObjectManager::getInstance()->create('Mage\\Adminhtml\\Test\\Block\\Template', ['element' => $this->driver->find($this->templateBlock, Locator::SELECTOR_XPATH)]);
 }
开发者ID:TalissonBento,项目名称:Pharmacy,代码行数:9,代码来源:ConditionsElement.php


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