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

PHP Helper\ObjectManager类代码示例

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

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



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

示例1: setUp

 protected function setUp()
 {
     $this->select = $this->getMockBuilder('\\Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->setMethods(['from', 'joinLeft', 'where', 'joinInner'])->getMock();
     $this->adapter = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->setMethods(['select', 'quoteInto'])->getMockForAbstractClass();
     $this->adapter->expects($this->once())->method('select')->will($this->returnValue($this->select));
     $this->resource = $this->getMockBuilder('\\Magento\\Framework\\App\\Resource')->disableOriginalConstructor()->setMethods(['getConnection', 'getTableName'])->getMock();
     $this->resource->expects($this->any())->method('getConnection')->with(\Magento\Framework\App\Resource::DEFAULT_READ_RESOURCE)->will($this->returnValue($this->adapter));
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\Search\\RequestInterface')->disableOriginalConstructor()->setMethods(['getIndex', 'getDimensions', 'getQuery'])->getMockForAbstractClass();
     $this->request->expects($this->once())->method('getQuery')->willReturn($this->getMockBuilder('Magento\\Framework\\Search\\Request\\QueryInterface')->getMockForAbstractClass());
     $this->config = $this->getMockBuilder('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface')->disableOriginalConstructor()->setMethods(['isSetFlag'])->getMockForAbstractClass();
     $this->storeManager = $this->getMockBuilder('Magento\\Store\\Model\\StoreManagerInterface')->getMock();
     $this->scopeResolver = $this->getMockBuilder('\\Magento\\Indexer\\Model\\ScopeResolver\\IndexScopeResolver')->disableOriginalConstructor()->getMock();
     $this->conditionManager = $this->getMockBuilder('\\Magento\\Framework\\Search\\Adapter\\Mysql\\ConditionManager')->setMethods(['combineQueries', 'wrapBrackets', 'generateCondition'])->disableOriginalConstructor()->getMock();
     $this->conditionManager->expects($this->any())->method('combineQueries')->willReturnCallback(function (array $queries, $expression) {
         return implode(' ' . $expression . ' ', $queries);
     });
     $this->conditionManager->expects($this->any())->method('wrapBrackets')->willReturnCallback(function ($expression) {
         return '(' . $expression . ')';
     });
     $this->conditionManager->expects($this->any())->method('generateCondition')->willReturnCallback(function ($left, $operator, $right) {
         return $left . $operator . $right;
     });
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->target = $objectManagerHelper->getObject('Magento\\CatalogSearch\\Model\\Search\\IndexBuilder', ['resource' => $this->resource, 'config' => $this->config, 'storeManager' => $this->storeManager, 'conditionManager' => $this->conditionManager, 'scopeResolver' => $this->scopeResolver]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:25,代码来源:IndexBuilderTest.php


示例2: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->metadata = $this->getMock('Magento\\Sales\\Model\\ResourceModel\\Metadata', ['getNewInstance', 'getMapper'], [], '', false);
     $this->searchResultFactory = $this->getMock('Magento\\Sales\\Api\\Data\\ShipmentSearchResultInterfaceFactory', ['create'], [], '', false);
     $this->subject = $objectManager->getObject('Magento\\Sales\\Model\\Order\\ShipmentRepository', ['metadata' => $this->metadata, 'searchResultFactory' => $this->searchResultFactory]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:ShipmentRepositoryTest.php


示例3: setUp

 protected function setUp()
 {
     $this->scopeConfigMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->requestMock = $this->getMock('Magento\\Framework\\App\\Request\\Http', [], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->designExceptions = $this->objectManagerHelper->getObject('Magento\\Framework\\View\\DesignExceptions', ['scopeConfig' => $this->scopeConfigMock, 'exceptionConfigPath' => $this->exceptionConfigPath, 'scopeType' => $this->scopeType]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:DesignExceptionsTest.php


示例4: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->taxRuleModelFactoryMock = $this->getMockBuilder('Magento\\Tax\\Model\\Calculation\\RuleFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->taxRuleRegistry = $objectManager->getObject('Magento\\Tax\\Model\\Calculation\\TaxRuleRegistry', ['taxRuleModelFactory' => $this->taxRuleModelFactoryMock]);
     $this->taxRuleModelMock = $this->getMockBuilder('Magento\\Tax\\Model\\Calculation\\Rule')->disableOriginalConstructor()->getMock();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:TaxRuleRegistryTest.php


示例5: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->setFactoryMock = $this->getMock('\\Magento\\Eav\\Model\\Entity\\Attribute\\SetFactory', ['create', '__wakeup'], [], '', false);
     $this->typeFactoryMock = $this->getMock('\\Magento\\Eav\\Model\\Entity\\TypeFactory', ['create', '__wakeup'], [], '', false);
     $this->model = $objectManager->getObject('Magento\\Catalog\\Model\\ResourceModel\\Product', ['setFactory' => $this->setFactoryMock, 'typeFactory' => $this->typeFactoryMock]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:ProductTest.php


示例6: setUp

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function setUp()
 {
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $connection = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', ['quote'], [], '', false);
     $connection->expects($this->any())->method('quote')->will($this->returnValue('\'TestProductName\''));
     $resource = $this->getMock('Magento\\Wishlist\\Model\\Resource\\Item', ['getReadConnection', 'getMainTable', 'getTableName', 'getTable'], [], '', false);
     $resource->expects($this->any())->method('getReadConnection')->will($this->returnValue($connection));
     $resource->expects($this->any())->method('getMainTable')->will($this->returnValue('testMainTableName'));
     $resource->expects($this->any())->method('getTableName')->will($this->returnValue('testMainTableName'));
     $resource->expects($this->any())->method('getTable')->will($this->returnValue('testMainTableName'));
     $catalogConfFactory = $this->getMock('Magento\\Catalog\\Model\\Resource\\ConfigFactory', ['create'], [], '', false);
     $catalogConf = $this->getMock('Magento\\Catalog\\Model\\Resource\\Config', ['getEntityTypeId'], [], '', false);
     $catalogConf->expects($this->once())->method('getEntityTypeId')->will($this->returnValue(4));
     $catalogConfFactory->expects($this->once())->method('create')->will($this->returnValue($catalogConf));
     $attribute = $this->getMock('Magento\\Catalog\\Model\\Entity\\Attribute', ['loadByCode', 'getBackendTable', 'getId'], [], '', false);
     $attribute->expects($this->once())->method('loadByCode')->with(4, 'name')->will($this->returnSelf());
     $attribute->expects($this->once())->method('getBackendTable')->will($this->returnValue($this->attrTableName));
     $attribute->expects($this->once())->method('getId')->will($this->returnValue($this->attrId));
     $catalogAttrFactory = $this->getMock('Magento\\Catalog\\Model\\Entity\\AttributeFactory', ['create'], [], '', false);
     $catalogAttrFactory->expects($this->once())->method('create')->will($this->returnValue($attribute));
     $store = $this->getMock('Magento\\Store\\Model\\Store', ['getId'], [], '', false);
     $store->expects($this->once())->method('getId')->will($this->returnValue($this->storeId));
     $storeManager = $this->getMock('Magento\\Store\\Model\\StoreManager', ['getStore'], [], '', false);
     $storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store));
     $this->collection = $this->objectManager->getObject('Magento\\Wishlist\\Model\\Resource\\Item\\Collection', ['resource' => $resource, 'catalogConfFactory' => $catalogConfFactory, 'catalogAttrFactory' => $catalogAttrFactory, 'storeManager' => $storeManager]);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:29,代码来源:CollectionTest.php


示例7: setUp

 /**
  * Set up helper.
  */
 protected function setUp()
 {
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $typeProcessor = $this->objectManager->getObject('Magento\\Framework\\Reflection\\TypeProcessor');
     $objectManagerMock = $this->getMockBuilder('Magento\\Framework\\App\\ObjectManager')->disableOriginalConstructor()->getMock();
     $classReflection = $this->getMock('Magento\\Webapi\\Model\\Config\\ClassReflector', ['reflectClassMethods'], ['_typeProcessor' => $typeProcessor], '');
     $classReflection->expects($this->any())->method('reflectClassMethods')->will($this->returnValue([]));
     $servicesConfig = ['services' => ['Magento\\Customer\\Api\\AccountManagementInterface' => ['V1' => ['methods' => ['activate' => ['resources' => [['Magento_Customer::manage']], 'secure' => false]]]], 'Magento\\Customer\\Api\\CustomerRepositoryInterface' => ['V1' => ['methods' => ['getById' => ['resources' => [['Magento_Customer::customer']], 'secure' => false]]]]]];
     /**
      * @var $registryMock \Magento\Framework\Registry
      */
     $registryMock = $this->getMockBuilder('Magento\\Framework\\Registry')->disableOriginalConstructor()->getMock();
     /**
      * @var $cacheMock \Magento\Framework\App\Cache\Type\Webapi
      */
     $cacheMock = $this->getMockBuilder('Magento\\Framework\\App\\Cache\\Type\\Webapi')->disableOriginalConstructor()->getMock();
     /** @var $readerMock \Magento\Webapi\Model\Config\Reader */
     $readerMock = $this->getMockBuilder('Magento\\Webapi\\Model\\Config\\Reader')->disableOriginalConstructor()->getMock();
     $readerMock->expects($this->any())->method('read')->will($this->returnValue($servicesConfig));
     /** @var $config \Magento\Webapi\Model\Config */
     $config = new \Magento\Webapi\Model\Config($cacheMock, $readerMock);
     /** @var $config \Magento\Webapi\Model\ServiceMetadata */
     $serviceMetadata = new \Magento\Webapi\Model\ServiceMetadata($config, $cacheMock, $classReflection, $typeProcessor);
     $this->_soapConfig = $this->objectManager->getObject('Magento\\Webapi\\Model\\Soap\\Config', ['objectManager' => $objectManagerMock, 'registry' => $registryMock, 'serviceMetadata' => $serviceMetadata]);
     parent::setUp();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:29,代码来源:ConfigTest.php


示例8: setUp

 public function setUp()
 {
     $this->orderFactory = $this->getMock('\\Magento\\Sales\\Model\\OrderFactory', ['create'], [], '', false);
     $objectManagerHelper = new ObjectManagerHelper($this);
     $arguments = ['context' => $this->getMock('Magento\\Framework\\Model\\Context', [], [], '', false), 'registry' => $this->getMock('Magento\\Framework\\Registry', [], [], '', false), 'localeDate' => $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface', [], [], '', false), 'dateTime' => $this->getMock('Magento\\Framework\\Stdlib\\DateTime', [], [], '', false), 'orderFactory' => $this->orderFactory, 'shipmentItemCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Shipment\\Item\\CollectionFactory', [], [], '', false), 'trackCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Shipment\\Track\\CollectionFactory', [], [], '', false), 'commentFactory' => $this->getMock('Magento\\Sales\\Model\\Order\\Shipment\\CommentFactory', [], [], '', false), 'commentCollectionFactory' => $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Shipment\\Comment\\CollectionFactory', [], [], '', false)];
     $this->shipment = $objectManagerHelper->getObject('Magento\\Sales\\Model\\Order\\Shipment', $arguments);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:7,代码来源:ShipmentTest.php


示例9: setUp

 protected function setUp()
 {
     $this->entityFactoryMock = $this->getMock('Magento\\Framework\\Data\\Collection\\EntityFactory', [], [], '', false);
     $this->loggerMock = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->fetchStrategyMock = $this->getMock('Magento\\Framework\\Data\\Collection\\Db\\FetchStrategyInterface');
     $this->managerInterfaceMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface');
     $this->configMock = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->entityFactoryMock2 = $this->getMock('Magento\\Eav\\Model\\EntityFactory', [], [], '', false);
     $this->helperMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Helper', [], [], '', false);
     $entity = $this->getMock('Magento\\Eav\\Model\\Entity\\AbstractEntity', [], [], '', false);
     $adapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [], '', false);
     $entity->expects($this->any())->method('getReadConnection')->will($this->returnValue($adapter));
     $entity->expects($this->any())->method('getDefaultAttributes')->will($this->returnValue([]));
     $this->universalFactoryMock = $this->getMock('Magento\\Framework\\Validator\\UniversalFactory', [], [], '', false);
     $this->universalFactoryMock->expects($this->any())->method('create')->will($this->returnValue($entity));
     $this->storeManagerMock = $this->getMockForAbstractClass('Magento\\Store\\Model\\StoreManagerInterface');
     $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnCallback(function ($store) {
         return is_object($store) ? $store : new \Magento\Framework\Object(['id' => 42]);
     }));
     $this->catalogHelperMock = $this->getMock('Magento\\Catalog\\Helper\\Data', [], [], '', false);
     $this->stateMock = $this->getMock('Magento\\Catalog\\Model\\Indexer\\Product\\Flat\\State', [], [], '', false);
     $this->scopeConfigInterfaceMock = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $this->optionFactoryMock = $this->getMock('Magento\\Catalog\\Model\\Product\\OptionFactory', [], [], '', false);
     $this->urlMock = $this->getMock('Magento\\Catalog\\Model\\Resource\\Url', [], [], '', false);
     $this->timezoneInterfaceMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $this->sessionMock = $this->getMock('Magento\\Customer\\Model\\Session', [], [], '', false);
     $this->dateTimeMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->collection = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Resource\\Product\\Link\\Product\\Collection', ['entityFactory' => $this->entityFactoryMock, 'logger' => $this->loggerMock, 'fetchStrategy' => $this->fetchStrategyMock, 'eventManager' => $this->managerInterfaceMock, 'eavConfig' => $this->configMock, 'resource' => $this->resourceMock, 'eavEntityFactory' => $this->entityFactoryMock2, 'resourceHelper' => $this->helperMock, 'universalFactory' => $this->universalFactoryMock, 'storeManager' => $this->storeManagerMock, 'catalogData' => $this->catalogHelperMock, 'catalogProductFlatState' => $this->stateMock, 'scopeConfig' => $this->scopeConfigInterfaceMock, 'productOptionFactory' => $this->optionFactoryMock, 'catalogUrl' => $this->urlMock, 'localeDate' => $this->timezoneInterfaceMock, 'customerSession' => $this->sessionMock, 'dateTime' => $this->dateTimeMock]);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:31,代码来源:CollectionTest.php


示例10: setUp

 protected function setUp()
 {
     $this->paypalMethodMock = $this->getMockBuilder('\\Magento\\Braintree\\Model\\PaymentMethod\\PayPal')->disableOriginalConstructor()->getMock();
     $this->paypalConfigMock = $this->getMockBuilder('\\Magento\\Braintree\\Model\\Config\\PayPal')->disableOriginalConstructor()->getMock();
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->addPaypalShortcutsObserver = $this->objectManagerHelper->getObject('Magento\\Braintree\\Observer\\AddPaypalShortcuts', ['methodPayPal' => $this->paypalMethodMock, 'paypalConfig' => $this->paypalConfigMock]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:AddPaypalShortcutsTest.php


示例11: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->_storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $this->_authorizationMock = $this->getMock('Magento\\Framework\\AuthorizationInterface');
     $this->_model = $objectManager->getObject('Magento\\Config\\Model\\Config\\Structure\\Element\\Section', ['storeManager' => $this->_storeManagerMock, 'authorization' => $this->_authorizationMock]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:SectionTest.php


示例12: setUp

 public function setUp()
 {
     parent::setUp();
     $objectManager = new ObjectManager($this);
     $this->entitySnapshot = $this->getMock('Magento\\Framework\\Model\\ResourceModel\\Db\\VersionControl\\Snapshot', ['registerSnapshot'], [], '', false);
     $this->subject = $objectManager->getObject('Magento\\Eav\\Test\\Unit\\Model\\Entity\\Collection\\VersionControl\\AbstractCollectionStub', ['entityFactory' => $this->coreEntityFactoryMock, 'universalFactory' => $this->validatorFactoryMock, 'entitySnapshot' => $this->entitySnapshot]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:AbstractCollectionTest.php


示例13: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->connection = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMock();
     $this->connection->expects($this->any())->method('quoteInto')->willReturnCallback(function ($query, $expression) {
         return str_replace('?', $expression, $query);
     });
     $this->resource = $this->getMockBuilder('\\Magento\\Framework\\App\\ResourceConnection')->disableOriginalConstructor()->getMock();
     $this->resource->method('getTableName')->willReturnCallback(function ($table) {
         return 'prefix_' . $table;
     });
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->website = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\WebsiteInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->website->expects($this->any())->method('getId')->willReturn(self::WEBSITE_ID);
     $this->store = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\StoreInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->store->expects($this->any())->method('getId')->willReturn(self::STORE_ID);
     $this->storeManager = $this->getMockBuilder('\\Magento\\Store\\Model\\StoreManagerInterface')->disableOriginalConstructor()->getMock();
     $this->storeManager->expects($this->any())->method('getWebsite')->willReturn($this->website);
     $this->storeManager->expects($this->any())->method('getStore')->willReturn($this->store);
     $this->attributeCollection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection')->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory->expects($this->once())->method('create')->willReturn($this->attributeCollection);
     $this->target = $objectManager->getObject('\\Magento\\CatalogSearch\\Model\\Search\\TableMapper', ['resource' => $this->resource, 'storeManager' => $this->storeManager, 'attributeCollectionFactory' => $attributeCollectionFactory]);
     $this->select = $this->getMockBuilder('\\Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\Search\\RequestInterface')->disableOriginalConstructor()->getMock();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:26,代码来源:TableMapperTest.php


示例14: setUp

 public function setUp()
 {
     $this->_objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->_indexerMock = $this->getMock('Magento\\Indexer\\Model\\Indexer', ['getId', 'invalidate', 'getPriceIndexer', 'isScheduled'], [], '', false);
     $this->indexerRegistryMock = $this->getMock('Magento\\Framework\\Indexer\\IndexerRegistry', ['get'], [], '', false);
     $this->_model = $this->_objectManager->getObject('Magento\\CatalogImportExport\\Model\\Indexer\\Product\\Price\\Plugin\\Import', ['indexerRegistry' => $this->indexerRegistryMock]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:ImportTest.php


示例15: setUp

 public function setUp()
 {
     $this->dependencyFirst = $this->getMock('Magento\\Setup\\Module\\Dependency\\Report\\Dependency\\Data\\Dependency', [], [], '', false);
     $this->dependencySecond = $this->getMock('Magento\\Setup\\Module\\Dependency\\Report\\Dependency\\Data\\Dependency', [], [], '', false);
     $objectManagerHelper = new ObjectManager($this);
     $this->module = $objectManagerHelper->getObject('Magento\\Setup\\Module\\Dependency\\Report\\Dependency\\Data\\Module', ['name' => 'name', 'dependencies' => [$this->dependencyFirst, $this->dependencySecond]]);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:7,代码来源:ModuleTest.php


示例16: setUp

 public function setUp()
 {
     $this->customerFactory = $this->getMockBuilder('Magento\\Customer\\Model\\CustomerFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $objectManager = new ObjectManager($this);
     $this->customerRegistry = $objectManager->getObject('Magento\\Customer\\Model\\CustomerRegistry', ['customerFactory' => $this->customerFactory]);
     $this->customer = $this->getMockBuilder('Magento\\Customer\\Model\\Customer')->disableOriginalConstructor()->setMethods(['load', 'getId', 'getEmail', 'getWebsiteId', '__wakeup', 'setEmail', 'setWebsiteId', 'loadByEmail'])->getMock();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:CustomerRegistryTest.php


示例17: setUp

 protected function setUp()
 {
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->filePath = __DIR__ . '/_files/';
     $this->source = new \DOMDocument();
     $this->model = $this->objectManagerHelper->getObject(Converter::class);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:ConverterTest.php


示例18: setUp

 protected function setUp()
 {
     $this->helper = new ObjectManager($this);
     $this->scopeConfig = $this->getMockBuilder('\\Magento\\Framework\\App\\Config\\ScopeConfigInterface')->disableOriginalConstructor()->getMock();
     $this->objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface');
     $this->adapterFactory = $this->helper->getObject('\\Magento\\Search\\Model\\AdapterFactory', ['objectManager' => $this->objectManager, 'scopeConfig' => $this->scopeConfig, 'path' => 'some_path', 'scopeType' => 'some_scopeType', 'adapters' => ['ClassName' => 'ClassName']]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:AdapterFactoryTest.php


示例19: setUp

 protected function setUp()
 {
     $this->configMock = $this->getMockBuilder('\\Magento\\Braintree\\Model\\Config\\PayPal')->disableOriginalConstructor()->getMock();
     $this->localResolverMock = $this->getMock('\\Magento\\Framework\\Locale\\ResolverInterface');
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->model = $this->objectManagerHelper->getObject('Magento\\Braintree\\Model\\ConfigProvider\\PayPal', ['config' => $this->configMock, 'localeResolver' => $this->localResolverMock]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:7,代码来源:PayPalTest.php


示例20: setUp

 protected function setUp()
 {
     $this->urlInterface = $this->getMock('Magento\\Framework\\UrlInterface');
     $this->scopeConfigInterface = $this->getMock('Magento\\Framework\\App\\Config\\ScopeConfigInterface');
     $objectManagerHelper = new ObjectManagerHelper($this);
     $this->urlBuilder = $objectManagerHelper->getObject('Magento\\Rss\\Model\\UrlBuilder', ['urlBuilder' => $this->urlInterface, 'scopeConfig' => $this->scopeConfigInterface]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:7,代码来源:UrlBuilderTest.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP View\DesignInterface类代码示例发布时间:2022-05-23
下一篇:
PHP DateTime\TimezoneInterface类代码示例发布时间: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