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

PHP Pdo\Mysql类代码示例

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

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



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

示例1: setUp

 protected function setUp()
 {
     $this->select = $this->getMockBuilder('Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->getMock();
     $this->connection = $this->getMockBuilder('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql')->disableOriginalConstructor()->getMock();
     $this->connection->expects($this->any())->method('select')->willReturn($this->select);
     $this->resource = $this->getMockBuilder('Magento\\Framework\\Model\\ModelResource\\Db\\AbstractDb')->disableOriginalConstructor()->setMethods(['getConnection', 'getMainTable', 'getTable'])->getMockForAbstractClass();
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->resource->expects($this->any())->method('getMainTable')->willReturn('table_test');
     $this->resource->expects($this->any())->method('getTable')->willReturn('test');
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:11,代码来源:AbstractCollectionTest.php


示例2: setUp

 public function setUp()
 {
     $this->appResourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->validatorMock = $this->getMock('Magento\\Sales\\Model\\Order\\Status\\History\\Validator', [], [], '', false);
     $this->appResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->adapterMock->expects($this->any())->method('describeTable')->will($this->returnValue([]));
     $this->adapterMock->expects($this->any())->method('insert');
     $this->adapterMock->expects($this->any())->method('lastInsertId');
     $this->historyResource = $objectManager->getObject('Magento\\Sales\\Model\\Resource\\Order\\Status\\History', ['resource' => $this->appResourceMock, 'validator' => $this->validatorMock]);
 }
开发者ID:,项目名称:,代码行数:12,代码来源:


示例3: setUp

 /**
  * Mock class dependencies
  */
 protected function setUp()
 {
     $this->entityFactoryMock = $this->getMock('Magento\\Framework\\Data\\Collection\\EntityFactory', [], [], '', false);
     $this->fetchStrategyMock = $this->getMockForAbstractClass('Magento\\Framework\\Data\\Collection\\Db\\FetchStrategyInterface');
     $this->eventManagerMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface', [], [], '', false);
     $this->selectMock = $this->getMock('Zend_Db_Select', [], [], '', false);
     $this->connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->connectionMock->expects($this->atLeastOnce())->method('select')->will($this->returnValue($this->selectMock));
     $this->resourceMock = $this->getMock('Magento\\Framework\\Model\\Resource\\Db\\AbstractDb', [], [], '', false);
     $this->resourceMock->expects($this->any())->method('getReadConnection')->will($this->returnValue($this->connectionMock));
     $objectManager = new ObjectManager($this);
     $this->collection = $objectManager->getObject('Magento\\Quote\\Model\\Resource\\Quote\\Item\\Collection', ['entityFactory' => $this->entityFactoryMock, 'fetchStrategy' => $this->fetchStrategyMock, 'eventManager' => $this->eventManagerMock, 'resource' => $this->resourceMock]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:16,代码来源:CollectionTest.php


示例4: setUp

 protected function setUp()
 {
     $this->entityModel = $this->getMock('\\Magento\\CatalogImportExport\\Model\\Import\\Product', [], [], '', false);
     $attrSetColFactory = $this->getMock('\\Magento\\Eav\\Model\\Resource\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $attrSetCollection = $this->getMock('\\Magento\\Eav\\Model\\Resource\\Entity\\Attribute\\Set\\Collection', [], [], '', false);
     $attrColFactory = $this->getMock('\\Magento\\Catalog\\Model\\Resource\\Product\\Attribute\\CollectionFactory', ['create'], [], '', false);
     $attributeSet = $this->getMock('\\Magento\\Eav\\Model\\Entity\\Attribute\\Set', [], [], '', false);
     $attrCollection = $this->getMock('\\Magento\\Eav\\Model\\Resource\\Entity\\Attribute\\Collection', ['addFieldToFilter'], [], '', false);
     $attribute = $this->getMock('\\Magento\\Eav\\Model\\Entity\\Attribute', ['getAttributeCode', 'getId', 'getIsVisible', 'getIsGlobal', 'getIsRequired', 'getIsUnique', 'getFrontendLabel', 'isStatic', 'getApplyTo', 'getDefaultValue', 'usesSource', 'getFrontendInput'], [], '', false);
     $entityAttributes = ['attribute_id' => 'attributeSetName'];
     $this->entityModel->expects($this->any())->method('getEntityTypeId')->willReturn(3);
     $this->entityModel->expects($this->any())->method('getAttributeOptions')->willReturn(['option1', 'option2']);
     $attrSetColFactory->expects($this->any())->method('create')->willReturn($attrSetCollection);
     $attrSetCollection->expects($this->any())->method('setEntityTypeFilter')->willReturn([$attributeSet]);
     $attrColFactory->expects($this->any())->method('create')->willReturn($attrCollection);
     $attrCollection->expects($this->any())->method('setAttributeSetFilter')->willReturn([$attribute]);
     $attributeSet->expects($this->any())->method('getId')->willReturn(1);
     $attributeSet->expects($this->any())->method('getAttributeSetName')->willReturn('attribute_set_name');
     $attribute->expects($this->any())->method('getAttributeCode')->willReturn('attr_code');
     $attribute->expects($this->any())->method('getId')->willReturn('1');
     $attribute->expects($this->any())->method('getIsVisible')->willReturn(true);
     $attribute->expects($this->any())->method('getIsGlobal')->willReturn(true);
     $attribute->expects($this->any())->method('getIsRequired')->willReturn(true);
     $attribute->expects($this->any())->method('getIsUnique')->willReturn(true);
     $attribute->expects($this->any())->method('getFrontendLabel')->willReturn('frontend_label');
     $attribute->expects($this->any())->method('isStatic')->willReturn(true);
     $attribute->expects($this->any())->method('getApplyTo')->willReturn(['simple']);
     $attribute->expects($this->any())->method('getDefaultValue')->willReturn('default_value');
     $attribute->expects($this->any())->method('usesSource')->willReturn(true);
     $attribute->expects($this->any())->method('getFrontendInput')->willReturn('multiselect');
     $attrCollection->expects($this->any())->method('addFieldToFilter')->with('main_table.attribute_id', ['in' => [key($entityAttributes)]])->willReturn([$attribute]);
     $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', 'getAdapter'], [], '', 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));
     $adapter = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $adapter->expects($this->any())->method('quoteInto')->will($this->returnValue('query'));
     $this->select->expects($this->any())->method('getAdapter')->willReturn($adapter);
     $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('fetchPairs')->will($this->returnValue($entityAttributes));
     $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->objectManagerHelper = new ObjectManagerHelper($this);
     $this->simpleType = $this->objectManagerHelper->getObject('Magento\\CatalogImportExport\\Model\\Import\\Product\\Type\\Simple', ['attrSetColFac' => $attrSetColFactory, 'prodAttrColFac' => $attrColFactory, 'params' => [$this->entityModel, 'simple'], 'resource' => $this->resource]);
     $this->abstractType = $this->getMockBuilder('\\Magento\\CatalogImportExport\\Model\\Import\\Product\\Type\\AbstractType')->disableOriginalConstructor()->getMockForAbstractClass();
 }
开发者ID:nja78,项目名称:magento2,代码行数:51,代码来源:AbstractTypeTest.php


示例5: testUnshiftOrder

 /**
  * @param \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\DB\Adapter\Pdo\Mysql $adapter
  * @depends testSetAddOrder
  */
 public function testUnshiftOrder($adapter)
 {
     $renderer = $this->getSelectRenderer($this->objectManager);
     $select = new \Magento\Framework\DB\Select($adapter, $renderer);
     $adapter->expects($this->any())->method('select')->willReturn($select);
     $this->collection->setConnection($adapter);
     $this->collection->addOrder('some_field', \Magento\Framework\Data\Collection::SORT_ORDER_ASC);
     $this->collection->unshiftOrder('other_field', \Magento\Framework\Data\Collection::SORT_ORDER_ASC);
     $this->collection->load();
     $selectOrders = $this->collection->getSelect()->getPart(\Magento\Framework\DB\Select::ORDER);
     $this->assertEquals('other_field ASC', (string) array_shift($selectOrders));
     $this->assertEquals('some_field ASC', (string) array_shift($selectOrders));
     $this->assertEmpty(array_shift($selectOrders));
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:18,代码来源:DbTest.php


示例6: setUp

 public function setUp()
 {
     $this->addressMock = $this->getMock('Magento\\Sales\\Model\\Order\\Address', ['__wakeup', 'getOrderId', 'hasDataChanges'], [], '', false);
     $this->appResourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['describeTable', 'insert', 'lastInsertId'], [], '', false);
     $this->validatorMock = $this->getMock('Magento\\Sales\\Model\\Order\\Address\\Validator', [], [], '', false);
     $this->gridPoolMock = $this->getMock('Magento\\Sales\\Model\\Resource\\GridPool', ['refreshByOrderId'], [], '', false);
     $this->appResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->adapterMock->expects($this->any())->method('describeTable')->will($this->returnValue([]));
     $this->adapterMock->expects($this->any())->method('insert');
     $this->adapterMock->expects($this->any())->method('lastInsertId');
     $this->addressResource = $objectManager->getObject('Magento\\Sales\\Model\\Resource\\Order\\Address', ['resource' => $this->appResourceMock, 'validator' => $this->validatorMock, 'gridPool' => $this->gridPoolMock]);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:14,代码来源:AddressTest.php


示例7: setUp

 /**
  * Init
  */
 public function setUp()
 {
     $this->addressMock = $this->getMock('Magento\\Quote\\Model\\Quote\\Address', ['__wakeup', 'getOrderId', 'hasDataChanges', 'beforeSave', 'afterSave', 'validateBeforeSave', 'getOrder'], [], '', false);
     $this->quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', ['__wakeup', 'getId'], [], '', false);
     $this->appResourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->entitySnapshotMock = $this->getMock('Magento\\Framework\\Model\\Resource\\Db\\VersionControl\\Snapshot', [], [], '', false);
     $this->relationCompositeMock = $this->getMock('Magento\\Framework\\Model\\Resource\\Db\\VersionControl\\RelationComposite', [], [], '', false);
     $this->appResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->adapterMock->expects($this->any())->method('describeTable')->will($this->returnValue([]));
     $this->adapterMock->expects($this->any())->method('insert');
     $this->adapterMock->expects($this->any())->method('lastInsertId');
     $this->addressResource = $objectManager->getObject('Magento\\Quote\\Model\\Resource\\Quote\\Address', ['resource' => $this->appResourceMock, 'entitySnapshot' => $this->entitySnapshotMock, 'entityRelationComposite' => $this->relationCompositeMock]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:18,代码来源:QuoteAddressTest.php


示例8: setUp

 public function setUp()
 {
     $this->appResourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->validatorMock = $this->getMock('Magento\\Sales\\Model\\Order\\Status\\History\\Validator', [], [], '', false);
     $this->entitySnapshotMock = $this->getMock('Magento\\Framework\\Model\\Resource\\Db\\VersionControl\\Snapshot', [], [], '', false);
     $this->appResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->adapterMock->expects($this->any())->method('describeTable')->will($this->returnValue([]));
     $this->adapterMock->expects($this->any())->method('insert');
     $this->adapterMock->expects($this->any())->method('lastInsertId');
     $relationProcessorMock = $this->getMock('\\Magento\\Framework\\Model\\Resource\\Db\\ObjectRelationProcessor', [], [], '', false);
     $contextMock = $this->getMock('\\Magento\\Framework\\Model\\Resource\\Db\\Context', [], [], '', false);
     $contextMock->expects($this->once())->method('getResources')->willReturn($this->appResourceMock);
     $contextMock->expects($this->once())->method('getObjectRelationProcessor')->willReturn($relationProcessorMock);
     $this->historyResource = $objectManager->getObject('Magento\\Sales\\Model\\Resource\\Order\\Status\\History', ['context' => $contextMock, 'validator' => $this->validatorMock, 'entitySnapshot' => $this->entitySnapshotMock]);
 }
开发者ID:nja78,项目名称:magento2,代码行数:17,代码来源:HistoryTest.php


示例9: setUp

 public function setUp()
 {
     $this->object = $this->getMock('Magento\\Catalog\\Model\\Product', [], [], '', false);
     $this->adapter = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['getOldSku', '_populateToUrlGeneration'], [], '', false);
     $this->adapter->expects($this->any())->method('_populateToUrlGeneration')->willReturn($this->object);
     $this->adapter->expects($this->any())->method('getOldSku')->willReturn(['sku' => ['sku' => 'sku', 'url_key' => 'value1', 'entity_id' => '1'], 'sku2' => ['sku' => 'sku2', 'url_key' => 'value2', 'entity_id' => '2']]);
     $this->event = $this->getMock('\\Magento\\Framework\\Event', ['getAdapter', 'getBunch'], [], '', false);
     $this->event->expects($this->any())->method('getAdapter')->willReturn($this->adapter);
     $this->event->expects($this->any())->method('getBunch')->willReturn([['sku' => 'sku', 'url_key' => 'value1'], ['sku' => 'sku3', 'url_key' => 'value3']]);
     $this->observer = $this->getMock('\\Magento\\Framework\\Event\\Observer', ['getEvent'], [], '', false);
     $this->observer->expects($this->any())->method('getEvent')->willReturn($this->event);
     $this->urlPersist = $this->getMockBuilder('\\Magento\\UrlRewrite\\Model\\UrlPersistInterface')->disableOriginalConstructor()->getMock();
     $this->productUrlRewriteGenerator = $this->getMockBuilder('\\Magento\\CatalogUrlRewrite\\Model\\ProductUrlRewriteGenerator')->disableOriginalConstructor()->setMethods(['generate'])->getMock();
     $this->productRepository = $this->getMockBuilder('\\Magento\\Catalog\\Api\\ProductRepositoryInterface')->disableOriginalConstructor()->getMock();
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->import = $this->objectManagerHelper->getObject('\\Magento\\CatalogUrlRewrite\\Model\\Product\\Plugin\\Import', ['urlPersist' => $this->urlPersist, 'productUrlRewriteGenerator' => $this->productUrlRewriteGenerator, 'productRepository' => $this->productRepository]);
 }
开发者ID:kid17,项目名称:magento2,代码行数:17,代码来源:ImportTest.php


示例10: setUp

 /**
  * Set up
  */
 protected function setUp()
 {
     $this->trackModelMock = $this->getMock('Magento\\Sales\\Model\\Order\\Shipment\\Track', [], [], '', false);
     $this->appResourceMock = $this->getMock('Magento\\Framework\\App\\Resource', [], [], '', false);
     $this->adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->validatorMock = $this->getMock('Magento\\Sales\\Model\\Order\\Shipment\\Track\\Validator', [], [], '', false);
     $this->appResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->adapterMock));
     $this->adapterMock->expects($this->any())->method('describeTable')->will($this->returnValue([]));
     $this->adapterMock->expects($this->any())->method('insert');
     $this->adapterMock->expects($this->any())->method('lastInsertId');
     $this->trackModelMock->expects($this->any())->method('hasDataChanges')->will($this->returnValue(true));
     $this->trackModelMock->expects($this->any())->method('isSaveAllowed')->will($this->returnValue(true));
     $relationProcessorMock = $this->getMock('\\Magento\\Framework\\Model\\Resource\\Db\\ObjectRelationProcessor', [], [], '', false);
     $contextMock = $this->getMock('\\Magento\\Framework\\Model\\Resource\\Db\\Context', [], [], '', false);
     $contextMock->expects($this->once())->method('getResources')->willReturn($this->appResourceMock);
     $contextMock->expects($this->once())->method('getObjectRelationProcessor')->willReturn($relationProcessorMock);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->trackResource = $objectManager->getObject('Magento\\Sales\\Model\\Resource\\Order\\Shipment\\Track', ['context' => $contextMock, 'validator' => $this->validatorMock]);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:TrackTest.php


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


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


示例13: doInsert

 public function doInsert()
 {
     $tbl = $this->_resource->getTableName(Account::ENTITY_NAME);
     $bind = [Account::ATTR_CUST_ID => 1, Account::ATTR_ASSET_TYPE_ID => 2, Account::ATTR_BALANCE => 123.45];
     $this->_conn->insert($tbl, $bind);
     $result = $this->_conn->lastInsertId($tbl);
     return $result;
 }
开发者ID:flancer32,项目名称:sample_mage2_module,代码行数:8,代码来源:Call.php


示例14: testAddStoreFilterIfStoreIsInt

 /**
  * @param int $storeId
  * @param bool $withAdmin
  * @param array $condition
  * @dataProvider dataProviderForTestAddStoreFilterIfStoreIsInt
  * @covers \Magento\UrlRewrite\Model\Resource\UrlRewriteCollection
  */
 public function testAddStoreFilterIfStoreIsInt($storeId, $withAdmin, $condition)
 {
     $store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $store->expects($this->once())->method('getId')->will($this->returnValue($storeId));
     $this->storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store));
     $this->adapter->expects($this->once())->method('prepareSqlCondition')->with('store_id', ['in' => $condition]);
     $this->collection->addStoreFilter($storeId, $withAdmin);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:UrlRewriteCollectionTest.php


示例15: testSelectByCompositeKey

 public function testSelectByCompositeKey()
 {
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $selectMock->expects($this->once())->method('from')->will($this->returnValue($selectMock));
     $selectMock->expects($this->exactly(2))->method('where')->will($this->returnValue($selectMock));
     $this->adapterMock->expects($this->once())->method('select')->willReturn($selectMock);
     $this->adapterMock->expects($this->once())->method('fetchRow');
     $this->nonceResource->selectByCompositeKey('nonce', 5);
 }
开发者ID:nja78,项目名称:magento2,代码行数:9,代码来源:NonceTest.php


示例16: processAttributeGetter

 protected function processAttributeGetter($dbAttributes)
 {
     $select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->connection->expects($this->once())->method('select')->will($this->returnValue($select));
     $select->expects($this->once())->method('from')->will($this->returnSelf());
     $select->expects($this->once())->method('where')->will($this->returnSelf());
     $this->connection->expects($this->once())->method('fetchAll')->with($select)->will($this->returnValue($dbAttributes));
     $this->link->expects($this->any())->method('getAttributeTypeTable')->will($this->returnValue('table_name'));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:LinksTest.php


示例17: testSelectTokenByCustomerId

 public function testSelectTokenByCustomerId()
 {
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $selectMock->expects($this->once())->method('from')->will($this->returnValue($selectMock));
     $selectMock->expects($this->exactly(2))->method('where')->will($this->returnValue($selectMock));
     $this->adapterMock->expects($this->once())->method('select')->willReturn($selectMock);
     $this->adapterMock->expects($this->once())->method('fetchRow');
     $this->tokenResource->selectTokenByCustomerId(5);
 }
开发者ID:nja78,项目名称:magento2,代码行数:9,代码来源:TokenTest.php


示例18: testAddFieldToFilter

 /**
  * @test
  */
 public function testAddFieldToFilter()
 {
     $field = 'name';
     $value = 'test_filter';
     $searchSql = 'sql query';
     $this->connection->expects($this->any())->method('quoteIdentifier')->willReturn($searchSql);
     $this->connection->expects($this->any())->method('prepareSqlCondition')->willReturn($searchSql);
     $this->select->expects($this->once())->method('where')->with($searchSql, null, \Magento\Framework\DB\Select::TYPE_CONDITION);
     $this->assertSame($this->collection, $this->collection->addFieldToFilter($field, $value));
 }
开发者ID:ant-workaholic,项目名称:Store-locator,代码行数:13,代码来源:CollectionTest.php


示例19: testAssignState

 public function testAssignState()
 {
     $state = 'processing';
     $status = 'processing';
     $isDefault = 1;
     $visibleOnFront = 1;
     $tableName = 'sales_order_status_state';
     $this->connectionMock->expects($this->once())->method('update')->with($this->equalTo($tableName), $this->equalTo(['is_default' => 0]), $this->equalTo(['state = ?' => $state]));
     $this->connectionMock->expects($this->once())->method('insertOnDuplicate')->with($this->equalTo($tableName), $this->equalTo(['status' => $status, 'state' => $state, 'is_default' => $isDefault, 'visible_on_front' => $visibleOnFront]));
     $this->model->assignState($status, $state, $isDefault, $visibleOnFront);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:StatusTest.php


示例20: testGetTimeInSecondsSinceCreation

 public function testGetTimeInSecondsSinceCreation()
 {
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $selectMock->expects($this->any())->method('from')->will($this->returnValue($selectMock));
     $selectMock->expects($this->any())->method('reset')->will($this->returnValue($selectMock));
     $selectMock->expects($this->any())->method('columns')->will($this->returnValue($selectMock));
     $selectMock->expects($this->any())->method('where')->will($this->returnValue($selectMock));
     $this->adapterMock->expects($this->any())->method('select')->willReturn($selectMock);
     $this->adapterMock->expects($this->once())->method('fetchOne');
     $this->consumerResource->getTimeInSecondsSinceCreation(1);
 }
开发者ID:nja78,项目名称:magento2,代码行数:11,代码来源:ConsumerTest.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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