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


PHP ResourceConnection::expects方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->coreEntityFactoryMock = $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', [], [], '', false);
     $this->eventManagerMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface', [], [], '', false);
     $this->configMock = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->coreResourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resourceHelperMock = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Helper', [], [], '', false);
     $this->validatorFactoryMock = $this->getMock('Magento\\Framework\\Validator\\UniversalFactory', [], [], '', false);
     $this->entityFactoryMock = $this->getMock('Magento\\Eav\\Model\\EntityFactory', [], [], '', false);
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->statementMock = $this->getMock('Magento\\Framework\\DB\\Statement\\Pdo\\Mysql', ['fetch'], [], '', false);
     /** @var $selectMock \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject */
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->coreEntityFactoryMock->expects($this->any())->method('create')->will($this->returnCallback([$this, 'getMagentoObject']));
     $connectionMock->expects($this->any())->method('select')->will($this->returnValue($selectMock));
     $connectionMock->expects($this->any())->method('query')->willReturn($this->statementMock);
     $this->coreResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock));
     $entityMock = $this->getMock('Magento\\Eav\\Model\\Entity\\AbstractEntity', [], [], '', false);
     $entityMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock));
     $entityMock->expects($this->any())->method('getDefaultAttributes')->will($this->returnValue([]));
     $this->validatorFactoryMock->expects($this->any())->method('create')->with('test_entity_model')->will($this->returnValue($entityMock));
     $this->model = new AbstractCollectionStub($this->coreEntityFactoryMock, $this->loggerMock, $this->fetchStrategyMock, $this->eventManagerMock, $this->configMock, $this->coreResourceMock, $this->entityFactoryMock, $this->resourceHelperMock, $this->validatorFactoryMock, null);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:26,代码来源:AbstractCollectionTest.php

示例2: testDeleteRecordsOlderThen

 /**
  * @return void
  */
 public function testDeleteRecordsOlderThen()
 {
     $timestamp = 12345;
     $this->resourceMock->expects($this->once())->method('getConnection')->willReturn($this->dbAdapterMock);
     $this->dbAdapterMock->expects($this->once())->method('delete')->with($this->model->getMainTable(), ['created_at < ?' => $this->dateTimeMock->formatDate($timestamp)])->willReturnSelf();
     $this->assertEquals($this->model, $this->model->deleteRecordsOlderThen($timestamp));
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:10,代码来源:PasswordResetRequestEventTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->setCollectionFactory = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->setCollection = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection', ['setEntityTypeFilter'], [], '', false);
     $this->setCollectionFactory->expects($this->any())->method('create')->will($this->returnValue($this->setCollection));
     $this->setCollection->expects($this->any())->method('setEntityTypeFilter')->will($this->returnValue([]));
     $this->attrCollectionFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', ['create', 'addFieldToFilter'], [], '', false);
     $this->attrCollectionFactory->expects($this->any())->method('create')->will($this->returnSelf());
     $this->attrCollectionFactory->expects($this->any())->method('addFieldToFilter')->willReturn([]);
     $this->entityModel = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product', ['getErrorAggregator', 'getNewSku', 'getOldSku', 'getNextBunch', 'isRowAllowedToImport', 'getRowScope'], [], '', false);
     $this->entityModel->method('getErrorAggregator')->willReturn($this->getErrorAggregatorObject());
     $this->params = [0 => $this->entityModel, 1 => 'grouped'];
     $this->links = $this->getMock('Magento\\GroupedImportExport\\Model\\Import\\Product\\Type\\Grouped\\Links', [], [], '', false);
     $entityAttributes = [['attribute_set_name' => 'attribute_id', 'attribute_id' => 'attributeSetName']];
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto'], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\DB\\Select', ['from', 'where', 'joinLeft', 'getConnection'], [], '', false);
     $this->select->expects($this->any())->method('from')->will($this->returnSelf());
     $this->select->expects($this->any())->method('where')->will($this->returnSelf());
     $this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $connectionMock->expects($this->any())->method('quoteInto')->will($this->returnValue('query'));
     $this->select->expects($this->any())->method('getConnection')->willReturn($connectionMock);
     $this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
     $this->connection->expects($this->any())->method('delete')->willReturnSelf();
     $this->connection->expects($this->any())->method('quoteInto')->willReturn('');
     $this->connection->expects($this->any())->method('fetchAll')->will($this->returnValue($entityAttributes));
     $this->resource = $this->getMock('\\Magento\\Framework\\App\\ResourceConnection', ['getConnection', 'getTableName'], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection));
     $this->resource->expects($this->any())->method('getTableName')->will($this->returnValue('tableName'));
     $this->grouped = $this->objectManagerHelper->getObject('Magento\\GroupedImportExport\\Model\\Import\\Product\\Type\\Grouped', ['attrSetColFac' => $this->setCollectionFactory, 'prodAttrColFac' => $this->attrCollectionFactory, 'resource' => $this->resource, 'params' => $this->params, 'links' => $this->links]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:33,代码来源:GroupedTest.php

示例4: setUp

 protected function setUp()
 {
     $this->_adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
     $this->_resourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->_resourceMock->expects($this->any())->method('getConnection')->with('prefix')->will($this->returnValue($this->_adapterMock));
     $this->_model = $this->getMockForAbstractClass('Magento\\Framework\\DB\\Helper\\AbstractHelper', [$this->_resourceMock, 'prefix'], '', true, true, true, ['addLikeEscape']);
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:7,代码来源:AbstractHelperTest.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->entityModel = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product', ['getErrorAggregator', 'getBehavior', 'getNewSku', 'getNextBunch', 'isRowAllowedToImport', 'getRowScope', 'getConnection'], [], '', false);
     $this->entityModel->method('getErrorAggregator')->willReturn($this->getErrorAggregatorObject());
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto', 'fetchAssoc'], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->select->expects($this->any())->method('from')->will($this->returnSelf());
     $this->select->expects($this->any())->method('where')->will($this->returnSelf());
     $this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $this->select->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $this->initFetchAllCalls();
     $this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
     $this->connection->expects($this->any())->method('delete')->willReturnSelf();
     $this->connection->expects($this->any())->method('quoteInto')->willReturn('');
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', ['getConnection', 'getTableName'], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection));
     $this->resource->expects($this->any())->method('getTableName')->will($this->returnValue('tableName'));
     $this->attrSetColFac = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->setCollection = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection', ['setEntityTypeFilter'], [], '', false);
     $this->attrSetColFac->expects($this->any())->method('create')->will($this->returnValue($this->setCollection));
     $this->setCollection->expects($this->any())->method('setEntityTypeFilter')->will($this->returnValue([]));
     $this->prodAttrColFac = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', ['create'], [], '', false);
     $attrCollection = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection', [], [], '', false);
     $attrCollection->expects($this->any())->method('addFieldToFilter')->willReturn([]);
     $this->prodAttrColFac->expects($this->any())->method('create')->will($this->returnValue($attrCollection));
     $this->params = [0 => $this->entityModel, 1 => 'bundle'];
     $this->bundle = $this->objectManagerHelper->getObject('Magento\\BundleImportExport\\Model\\Import\\Product\\Type\\Bundle', ['attrSetColFac' => $this->attrSetColFac, 'prodAttrColFac' => $this->prodAttrColFac, 'resource' => $this->resource, 'params' => $this->params]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:30,代码来源:BundleTest.php

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

示例7: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->resourceMock = $this->getMockBuilder('Magento\\Framework\\App\\ResourceConnection')->disableOriginalConstructor()->getMock();
     $this->connectionMock = $this->getMockBuilder('Magento\\Framework\\DB\\Adapter\\AdapterInterface')->getMock();
     $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock);
     $this->helper = new Helper($this->resourceMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:HelperTest.php

示例8: testCreate

 public function testCreate()
 {
     $triggerName = 'trigger_name';
     $this->resourceMock->expects($this->atLeastOnce())->method('getTriggerName')->willReturn($triggerName);
     $triggerMock = $this->getMockBuilder('Magento\\Framework\\DB\\Ddl\\Trigger')->disableOriginalConstructor()->getMock();
     $triggerMock->expects($this->exactly(3))->method('setName')->with($triggerName)->will($this->returnSelf());
     $triggerMock->expects($this->exactly(3))->method('getName')->will($this->returnValue('triggerName'));
     $triggerMock->expects($this->exactly(3))->method('setTime')->with(\Magento\Framework\DB\Ddl\Trigger::TIME_AFTER)->will($this->returnSelf());
     $triggerMock->expects($this->exactly(3))->method('setEvent')->will($this->returnSelf());
     $triggerMock->expects($this->exactly(3))->method('setTable')->with($this->tableName)->will($this->returnSelf());
     $triggerMock->expects($this->exactly(6))->method('addStatement')->will($this->returnSelf());
     $changelogMock = $this->getMockForAbstractClass('Magento\\Framework\\Mview\\View\\ChangelogInterface', [], '', false, false, true, []);
     $changelogMock->expects($this->exactly(3))->method('getName')->will($this->returnValue('test_view_cl'));
     $changelogMock->expects($this->exactly(3))->method('getColumnName')->will($this->returnValue('entity_id'));
     $this->viewMock->expects($this->exactly(3))->method('getChangelog')->will($this->returnValue($changelogMock));
     $this->triggerFactoryMock->expects($this->exactly(3))->method('create')->will($this->returnValue($triggerMock));
     $otherChangelogMock = $this->getMockForAbstractClass('Magento\\Framework\\Mview\\View\\ChangelogInterface', [], '', false, false, true, []);
     $otherChangelogMock->expects($this->exactly(3))->method('getName')->will($this->returnValue('other_test_view_cl'));
     $otherChangelogMock->expects($this->exactly(3))->method('getColumnName')->will($this->returnValue('entity_id'));
     $otherViewMock = $this->getMockForAbstractClass('Magento\\Framework\\Mview\\ViewInterface', [], '', false, false, true, []);
     $otherViewMock->expects($this->exactly(1))->method('getId')->will($this->returnValue('other_id'));
     $otherViewMock->expects($this->exactly(1))->method('getSubscriptions')->will($this->returnValue([['name' => $this->tableName], ['name' => 'otherTableName']]));
     $otherViewMock->expects($this->exactly(3))->method('getChangelog')->will($this->returnValue($otherChangelogMock));
     $this->viewMock->expects($this->exactly(3))->method('getId')->will($this->returnValue('this_id'));
     $this->viewMock->expects($this->never())->method('getSubscriptions');
     $this->viewCollectionMock->expects($this->exactly(1))->method('getViewsByStateMode')->with(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED)->will($this->returnValue([$this->viewMock, $otherViewMock]));
     $this->connectionMock->expects($this->exactly(3))->method('dropTrigger')->with('triggerName')->will($this->returnValue(true));
     $this->connectionMock->expects($this->exactly(3))->method('createTrigger')->with($triggerMock);
     $this->model->create();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:30,代码来源:SubscriptionTest.php

示例9: testSave

 public function testSave()
 {
     $connectionMock = $this->getMock('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface', [], [], '', false);
     $resourceMock = $this->getMock('Magento\\Framework\\Model\\ResourceModel\\Db\\AbstractDb', ['_construct', 'getConnection', '__wakeup', 'getIdFieldName'], [], '', false);
     $connectionInterfaceMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface', [], [], '', false);
     $resourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionInterfaceMock));
     $data = 'tableName';
     $this->resourcesMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock));
     $this->resourcesMock->expects($this->any())->method('getTableName')->with($data)->will($this->returnValue('tableName'));
     $mainTableReflection = new \ReflectionProperty('Magento\\Framework\\Model\\ResourceModel\\Db\\AbstractDb', '_mainTable');
     $mainTableReflection->setAccessible(true);
     $mainTableReflection->setValue($this->model, 'tableName');
     $idFieldNameReflection = new \ReflectionProperty('Magento\\Framework\\Model\\ResourceModel\\Db\\AbstractDb', '_idFieldName');
     $idFieldNameReflection->setAccessible(true);
     $idFieldNameReflection->setValue($this->model, 'idFieldName');
     $connectionMock->expects($this->any())->method('save')->with('tableName', 'idFieldName');
     $connectionMock->expects($this->any())->method('quoteInto')->will($this->returnValue('idFieldName'));
     $abstractModelMock = $this->setupAbstractModel($resourceMock);
     $abstractModelMock->setIdFieldName('id');
     $abstractModelMock->setData(['id' => 12345, 'name' => 'Test Name', 'value' => 'Test Value']);
     $abstractModelMock->afterLoad();
     $this->assertEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData());
     $newData = ['value' => 'Test Value New'];
     $abstractModelMock->addData($newData);
     $this->assertNotEquals($abstractModelMock->getData(), $abstractModelMock->getStoredData());
     $abstractModelMock->isObjectNew(false);
     $connectionMock->expects($this->any())->method('update')->with('tableName', $newData, 'idFieldName');
     $this->relationProcessorMock->expects($this->once())->method('validateDataIntegrity');
     $this->entityManager->expects($this->once())->method('save');
     $this->model->save($abstractModelMock);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:31,代码来源:RuleTest.php

示例10: setUp

 protected function setUp()
 {
     $this->config = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->select = $this->getMockBuilder('Magento\\Framework\\DB\\Select')->setMethods(['select', 'from', 'where', 'join'])->disableOriginalConstructor()->getMock();
     $this->connection = $this->getMockBuilder('Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->storeViewService = (new ObjectManager($this))->getObject('Magento\\CatalogUrlRewrite\\Service\\V1\\StoreViewService', ['eavConfig' => $this->config, 'resource' => $this->resource]);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:9,代码来源:StoreViewServiceTest.php

示例11: setUp

 protected function setUp()
 {
     $this->connection = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->resource = $this->getMockBuilder('\\Magento\\Framework\\App\\ResourceConnection')->setMethods(['getConnection'])->disableOriginalConstructor()->getMock();
     $this->resource->expects($this->atLeastOnce())->method('getConnection')->willReturn($this->connection);
     $this->indexScopeResolver = $this->getMockBuilder('\\Magento\\Framework\\Indexer\\ScopeResolver\\IndexScopeResolver')->setMethods(['resolve'])->disableOriginalConstructor()->getMock();
     $objectManager = new ObjectManager($this);
     $this->target = $objectManager->getObject(\Magento\CatalogSearch\Model\Indexer\IndexStructure::class, ['resource' => $this->resource, 'indexScopeResolver' => $this->indexScopeResolver]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:IndexStructureTest.php

示例12: setUp

 public function setUp()
 {
     $this->connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock);
     $contextMock = $this->getMock('\\Magento\\Framework\\Model\\ModelResource\\Db\\Context', [], [], '', false);
     $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock);
     $this->tokenResource = new \Magento\Integration\Model\ResourceModel\Oauth\Token($contextMock, new \Magento\Framework\Stdlib\DateTime());
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:9,代码来源:TokenTest.php

示例13: setUp

 protected function setUp()
 {
     $this->connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock);
     $contextMock = $this->getMock('\\Magento\\Framework\\Model\\ResourceModel\\Db\\Context', [], [], '', false);
     $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock);
     $this->nonceResource = new \Magento\Integration\Model\ResourceModel\Oauth\Nonce($contextMock);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:9,代码来源:NonceTest.php

示例14: setUp

 protected function setUp()
 {
     $this->config = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\Db\\Select', [], [], '', false);
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface', [], [], '', false);
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection));
     $this->storeViewService = (new ObjectManager($this))->getObject('Magento\\CatalogUrlRewrite\\Service\\V1\\StoreViewService', ['eavConfig' => $this->config, 'resource' => $this->resource]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:StoreViewServiceTest.php

示例15: testGetTable

 public function testGetTable()
 {
     $tableName = 'table';
     $expectedTableName = 'expected_table';
     $this->resourceModel->expects($this->once())->method('getTableName')->with($tableName)->will($this->returnValue($expectedTableName));
     $this->assertSame($expectedTableName, $this->object->getTable($tableName));
     // Check that table name is cached
     $this->assertSame($expectedTableName, $this->object->getTable($tableName));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:SetupTest.php


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