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

PHP App\Resource类代码示例

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

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



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

示例1: setUp

 protected function setUp()
 {
     $this->entityModel = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product', ['getBehavior', 'getNewSku', 'getNextBunch', 'isRowAllowedToImport', 'getRowScope', 'getConnection'], [], '', false);
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto', 'fetchAssoc'], [], '', false);
     $select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $select->expects($this->any())->method('from')->will($this->returnSelf());
     $select->expects($this->any())->method('where')->will($this->returnSelf());
     $select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $adapter = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $adapter->expects($this->any())->method('quoteInto')->will($this->returnValue('query'));
     $select->expects($this->any())->method('getAdapter')->willReturn($adapter);
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($select));
     $this->connection->expects($this->any())->method('fetchPairs')->will($this->returnValue(['1' => '1', '2' => '2']));
     $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\\Resource', ['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\\Resource\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->setCollection = $this->getMock('Magento\\Eav\\Model\\Resource\\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\\Resource\\Product\\Attribute\\CollectionFactory', ['create'], [], '', false);
     $attrCollection = $this->getMock('\\Magento\\Catalog\\Model\\Resource\\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->objectManagerHelper = new ObjectManagerHelper($this);
     $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:nja78,项目名称:magento2,代码行数:31,代码来源:BundleTest.php


示例2: buildFilter

 /**
  * {@inheritdoc}
  */
 public function buildFilter(\Magento\Framework\Search\Request\FilterInterface $filter)
 {
     $adapter = $this->resource->getConnection(Resource::DEFAULT_READ_RESOURCE);
     /** @var \Magento\Framework\Search\Request\Filter\Term $filter */
     $condition = sprintf('%s = %s', $filter->getField(), $adapter->quote($filter->getValue()));
     return $condition;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:10,代码来源:Term.php


示例3: testPurge

 /**
  * Test purge method
  */
 public function testPurge()
 {
     $this->appResourceMock->expects($this->once())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $this->appResourceMock->expects($this->once())->method('getTableName')->will($this->returnValue('sales_flat_invoice_grid'));
     $this->adapterMock->expects($this->once())->method('delete')->with('sales_flat_invoice_grid', ['fi.field = ?' => 1])->will($this->returnValue(1));
     $this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:10,代码来源:GridTest.php


示例4: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->resourceMock = $this->getMockBuilder('Magento\\Framework\\App\\Resource')->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:nja78,项目名称:magento2,代码行数:10,代码来源:HelperTest.php


示例5: setUp

 protected function setUp()
 {
     $helper = new ObjectManager($this);
     $this->select = $this->getMockBuilder('Magento\\Framework\\DB\\Select')->setMethods(['group', 'limit', 'where', 'columns', 'from', 'join'])->disableOriginalConstructor()->getMock();
     $this->select->expects($this->any())->method('from')->willReturnSelf();
     $connectionAdapter = $this->getMockBuilder('Magento\\Framework\\DB\\Adapter\\AdapterInterface')->setMethods(['select'])->disableOriginalConstructor()->getMockForAbstractClass();
     $connectionAdapter->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $this->resource = $this->getMockBuilder('Magento\\Framework\\App\\Resource')->disableOriginalConstructor()->getMock();
     $this->resource->expects($this->any())->method('getConnection')->with(Resource::DEFAULT_READ_RESOURCE)->will($this->returnValue($connectionAdapter));
     $this->scoreBuilder = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\ScoreBuilder')->setMethods(['clear'])->disableOriginalConstructor()->getMock();
     $this->scoreBuilderFactory = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\ScoreBuilderFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->scoreBuilderFactory->expects($this->any())->method('create')->will($this->returnValue($this->scoreBuilder));
     $this->request = $this->getMockBuilder('Magento\\Framework\\Search\\RequestInterface')->setMethods(['getQuery', 'getIndex', 'getSize'])->disableOriginalConstructor()->getMockForAbstractClass();
     $this->queryContainer = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\Query\\QueryContainer')->setMethods(['addMatchQuery', 'getDerivedQueries'])->disableOriginalConstructor()->getMock();
     $this->queryContainer->expects($this->any())->method('addMatchQuery')->willReturnArgument(0);
     $queryContainerFactory = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\Query\\QueryContainerFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $queryContainerFactory->expects($this->any())->method('create')->willReturn($this->queryContainer);
     $this->filterBuilder = $this->getMockBuilder('Magento\\Framework\\Search\\Adapter\\Mysql\\Filter\\Builder')->setMethods(['build'])->disableOriginalConstructor()->getMock();
     $this->matchBuilder = $this->getMockBuilder('\\Magento\\Framework\\Search\\Adapter\\Mysql\\Query\\Builder\\Match')->setMethods(['build'])->disableOriginalConstructor()->getMock();
     $this->matchBuilder->expects($this->any())->method('build')->willReturnArgument(1);
     /** @var MockObject|\Magento\Framework\Search\Adapter\Mysql\IndexBuilderInterface $indexBuilder */
     $indexBuilder = $this->getMockBuilder('\\Magento\\Framework\\Search\\Adapter\\Mysql\\IndexBuilderInterface')->disableOriginalConstructor()->setMethods(['build'])->getMockForAbstractClass();
     $indexBuilder->expects($this->any())->method('build')->will($this->returnValue($this->select));
     $index = self::INDEX_NAME;
     $this->request->expects($this->exactly(2))->method('getIndex')->will($this->returnValue($index));
     $this->mapper = $helper->getObject('Magento\\Framework\\Search\\Adapter\\Mysql\\Mapper', ['resource' => $this->resource, 'scoreBuilderFactory' => $this->scoreBuilderFactory, 'queryContainerFactory' => $queryContainerFactory, 'filterBuilder' => $this->filterBuilder, 'matchBuilder' => $this->matchBuilder, 'indexProviders' => [$index => $indexBuilder]]);
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:27,代码来源:MapperTest.php


示例6: setUp

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


示例7: setUp

 public 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\\Resource', [], [], '', false);
     $this->resourceHelperMock = $this->getMock('Magento\\Eav\\Model\\Resource\\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\Pdo\Mysql|\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 \Zend_Db_Select|\PHPUnit_Framework_MockObject_MockObject */
     $selectMock = $this->getMock('Zend_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('getReadConnection')->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:nja78,项目名称:magento2,代码行数:26,代码来源:AbstractCollectionTest.php


示例8: __construct

 /**
  * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper
  * @param \Magento\Framework\App\Resource $resource
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
  * @param \Magento\Framework\StoreManagerInterface $storeManager
  * @param TableDataInterface $tableData
  */
 public function __construct(\Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper, \Magento\Framework\App\Resource $resource, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface $tableData)
 {
     $this->_productIndexerHelper = $productIndexerHelper;
     $this->_connection = $resource->getConnection('write');
     $this->_config = $config;
     $this->_storeManager = $storeManager;
     $this->_tableData = $tableData;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:15,代码来源:FlatTableBuilder.php


示例9: __construct

 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
  * @param \Magento\Framework\Model\Resource\AbstractResource $resource
  * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
  * @param \Magento\UrlRewrite\Helper\UrlRewrite $urlRewriteHelper
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\App\Resource $appResource
  * @param \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\UrlRewrite\Helper\UrlRewrite $urlRewriteHelper, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\Resource $appResource, \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [])
 {
     parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data);
     $this->urlRewriteHelper = $urlRewriteHelper;
     $this->connection = $appResource->getConnection(Resource::DEFAULT_WRITE_RESOURCE);
     $this->urlFinder = $urlFinder;
     $this->storeManager = $storeManager;
 }
开发者ID:nja78,项目名称:magento2,代码行数:21,代码来源:Suffix.php


示例10: __construct

 /**
  * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
  * @param \Psr\Log\LoggerInterface $logger
  * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
  * @param \Magento\Framework\App\Resource $resource
  */
 public function __construct(\Magento\Framework\Data\Collection\EntityFactory $entityFactory, \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\App\Resource $resource)
 {
     $this->_setIdFieldName('primary_id');
     parent::__construct($entityFactory, $logger, $fetchStrategy, $resource->getConnection('review_read'));
     $this->_summaryTable = $resource->getTableName('review_entity_summary');
     $this->_select->from($this->_summaryTable);
     $this->setItemObjectClass('Magento\\Review\\Model\\Review\\Summary');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:Collection.php


示例11: setUp

 /**
  * Set Up
  */
 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->requestFilter = $this->getMockBuilder('Magento\\Framework\\Search\\Request\\Filter\\Range')->setMethods(['getField', 'getFrom', 'getTo'])->disableOriginalConstructor()->getMock();
     $this->adapter = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->setMethods(['quote'])->getMockForAbstractClass();
     $this->resource = $this->getMockBuilder('Magento\\Framework\\App\\Resource')->setMethods(['getConnection'])->disableOriginalConstructor()->getMock();
     $this->resource->expects($this->once())->method('getConnection')->with(\Magento\Framework\App\Resource::DEFAULT_READ_RESOURCE)->will($this->returnValue($this->adapter));
     $this->filter = $objectManager->getObject('Magento\\Framework\\Search\\Adapter\\Mysql\\Filter\\Builder\\Range', ['resource' => $this->resource]);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:12,代码来源:RangeTest.php


示例12: testAggregate

 /**
  * @magentoDataFixture Magento/Review/_files/customer_review_with_rating.php
  */
 public function testAggregate()
 {
     $rating = $this->reviewCollection->getFirstItem();
     $this->reviewResource->aggregate($rating);
     $select = $this->adapter->select()->from($this->resource->getTableName('review_entity_summary'));
     $result = $this->adapter->fetchRow($select);
     $this->assertEquals(1, $result['reviews_count']);
     $this->assertEquals(40, $result['rating_summary']);
 }
开发者ID:nja78,项目名称:magento2,代码行数:12,代码来源:ReviewTest.php


示例13: __construct

 /**
  * @param Config $eavConfig
  * @param Resource $resource
  * @param \Magento\Catalog\Helper\Product $productHelper
  * @param StoreManagerInterface $storeManager
  * @param CategoryHelper $categoryHelper
  * @param Converter $converter
  */
 public function __construct(Config $eavConfig, Resource $resource, ProductHelper $productHelper, StoreManagerInterface $storeManager, CategoryHelper $categoryHelper, Converter $converter)
 {
     $this->eavConfig = $eavConfig;
     $this->connection = $resource->getConnection(Resource::DEFAULT_READ_RESOURCE);
     $this->productHelper = $productHelper;
     $this->storeManager = $storeManager;
     $this->categoryHelper = $categoryHelper;
     $this->converter = $converter;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:17,代码来源:Data.php


示例14: setUp

 /**
  * Initialization
  */
 protected function setUp()
 {
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->appResourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->appResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $this->appResourceMock->expects($this->any())->method('getTableName')->willReturnArgument(0);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->taxItem = $objectManager->getObject('Magento\\Sales\\Model\\Resource\\Order\\Tax\\Item', ['resource' => $this->appResourceMock]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:12,代码来源:ItemTest.php


示例15: setUp

 protected function setUp()
 {
     $adapter = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->getMock();
     $this->resource = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($adapter));
     $this->relation = $this->getMock('Magento\\Catalog\\Model\\Resource\\Product\\Relation', [], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->configurable = $this->objectManagerHelper->getObject('Magento\\ConfigurableProduct\\Model\\Resource\\Product\\Type\\Configurable', ['resource' => $this->resource, 'catalogProductRelation' => $this->relation]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:9,代码来源:ConfigurableTest.php


示例16: __construct

 /**
  * @param \Magento\Framework\App\Resource $resource
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper
  * @param \Magento\Catalog\Model\Product\Type $productType
  * @param TableBuilder $tableBuilder
  * @param FlatTableBuilder $flatTableBuilder
  */
 public function __construct(\Magento\Framework\App\Resource $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Product\Flat\Indexer $productHelper, \Magento\Catalog\Model\Product\Type $productType, TableBuilder $tableBuilder, FlatTableBuilder $flatTableBuilder)
 {
     $this->_storeManager = $storeManager;
     $this->_productIndexerHelper = $productHelper;
     $this->_productType = $productType;
     $this->_connection = $resource->getConnection('default');
     $this->_tableBuilder = $tableBuilder;
     $this->_flatTableBuilder = $flatTableBuilder;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:AbstractAction.php


示例17: setUp

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


示例18: setUp

 public function setUp()
 {
     $this->consumerMock = $this->getMock('Magento\\Integration\\Model\\Oauth\\Consumer', ['setUpdatedAt', 'getId'], [], '', false);
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->adapterMock);
     $contextMock = $this->getMock('Magento\\Framework\\Model\\Resource\\Db\\Context', [], [], '', false);
     $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock);
     $this->consumerResource = new \Magento\Integration\Model\Resource\Oauth\Consumer($contextMock, new \Magento\Framework\Stdlib\DateTime());
 }
开发者ID:nja78,项目名称:magento2,代码行数:10,代码来源:ConsumerTest.php


示例19: loadLogData

 /**
  * Load customer log data by customer id
  *
  * @param int $customerId
  * @return array
  */
 protected function loadLogData($customerId)
 {
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
     $adapter = $this->resource->getConnection('read');
     $select = $adapter->select()->from(['cl' => $this->resource->getTableName('customer_log')])->joinLeft(['cv' => $this->resource->getTableName('customer_visitor')], 'cv.customer_id = cl.customer_id', ['last_visit_at'])->where('cl.customer_id = ?', $customerId)->order('cv.visitor_id DESC')->limit(1);
     return $adapter->fetchRow($select);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:Logger.php


示例20: testPrepareProductIndexForBundleProduct

 /**
  * @magentoDataFixture Magento/Bundle/_files/product.php
  * @covers \Magento\Indexer\Model\Indexer::reindexAll
  * @covers \Magento\Bundle\Model\Product\Type::getSearchableData
  */
 public function testPrepareProductIndexForBundleProduct()
 {
     $this->indexer->reindexAll();
     $select = $this->adapter->select()->from($this->resource->getTableName('catalogsearch_fulltext_scope1'))->where('`data_index` LIKE ?', '%' . 'Bundle Product Items' . '%');
     $result = $this->adapter->fetchAll($select);
     $this->assertCount(1, $result);
 }
开发者ID:nja78,项目名称:magento2,代码行数:12,代码来源:TypeTest.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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