本文整理汇总了PHP中Magento\Framework\App\ResourceConnection类的典型用法代码示例。如果您正苦于以下问题:PHP ResourceConnection类的具体用法?PHP ResourceConnection怎么用?PHP ResourceConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ResourceConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']);
}
示例2: 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();
}
示例3: getConnection
/**
* Returns Adapter interface
*
* @return array \Magento\Framework\DB\Adapter\AdapterInterface
*/
public function getConnection()
{
if (!$this->connection) {
$this->connection = $this->resource->getConnection(\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION);
}
return $this->connection;
}
示例4: 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]);
}
示例5: 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);
}
示例6: 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]);
}
示例7: 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);
}
示例8: __construct
/**
* @param ResourceConnection $resource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper
*/
public function __construct(ResourceConnection $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper)
{
$this->resource = $resource;
$this->connection = $resource->getConnection();
$this->storeManager = $storeManager;
$this->resourceHelper = $resourceHelper;
$this->columns = array_merge($this->getStaticColumns(), $this->getEavColumns());
}
示例9: getConnection
public function getConnection($name = null)
{
if (is_null($name)) {
$name = \Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION;
}
$result = $this->_resource->getConnection($name);
return $result;
}
示例10: getLotsByProductId
public function getLotsByProductId($prodId, $stockId)
{
/** @var \Magento\Framework\DB\Adapter\AdapterInterface $conn */
$conn = $this->_repoGeneric->getConnection();
/* aliases and tables */
$asStockItem = 'csi';
$asQty = 'pwq';
$asLot = 'pwl';
$tblStockItem = [$asStockItem => $this->_resource->getTableName(Cfg::ENTITY_MAGE_CATALOGINVENTORY_STOCK_ITEM)];
$tblQty = [$asQty => $this->_resource->getTableName(Quantity::ENTITY_NAME)];
$tblLot = [$asLot => $this->_resource->getTableName(Lot::ENTITY_NAME)];
/* SELECT FROM cataloginventory_stock_item */
$query = $conn->select();
$cols = [Alias::AS_STOCK_ITEM_ID => Cfg::E_CATINV_STOCK_ITEM_A_ITEM_ID];
$query->from($tblStockItem, $cols);
/* LEFT JOIN prxgt_wrhs_qty pwq */
$on = $asQty . '.' . Quantity::ATTR_STOCK_ITEM_REF . '=' . $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_ITEM_ID;
$cols = [Alias::AS_QTY => Quantity::ATTR_TOTAL];
$query->joinLeft($tblQty, $on, $cols);
// LEFT JOIN prxgt_wrhs_lot pwl
$on = $asLot . '.' . Lot::ATTR_ID . '=' . $asQty . '.' . Quantity::ATTR_LOT_REF;
$cols = [Alias::AS_LOT_ID => Lot::ATTR_ID, Alias::AS_LOT_CODE => Lot::ATTR_CODE, Alias::AS_LOT_EXP_DATE => Lot::ATTR_EXP_DATE];
$query->joinLeft($tblLot, $on, $cols);
/* where */
$where = $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_PROD_ID . '=' . (int) $prodId;
$where .= ' AND ' . $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_STOCK_ID . '=' . (int) $stockId;
$query->where($where);
/* order by */
$order = $asLot . '.' . Lot::ATTR_EXP_DATE . ' ASC';
$query->order($order);
/* fetch data */
$result = $conn->fetchAll($query);
return $result;
}
示例11: 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->connectionMock->select()->from($this->resource->getTableName('catalogsearch_fulltext_scope1'))->where('`data_index` LIKE ?', '%' . 'Bundle Product Items' . '%');
$result = $this->connectionMock->fetchAll($select);
$this->assertCount(1, $result);
}
示例12: getConnection
/**
* @return \Magento\Framework\DB\Adapter\AdapterInterface
*/
protected function getConnection()
{
if (!$this->connection) {
$this->connection = $this->resource->getConnection('sales');
}
return $this->connection;
}
示例13: install
/**
* {@inheritdoc}
*/
public function install(array $fixtures)
{
/** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */
$adapter = $this->resource->getConnection('core_write');
$regions = $this->loadDirectoryRegions();
foreach ($fixtures as $fileName) {
$fileName = $this->fixtureManager->getFixture($fileName);
if (!file_exists($fileName)) {
continue;
}
$rows = $this->csvReader->getData($fileName);
$header = array_shift($rows);
foreach ($rows as $row) {
$data = [];
foreach ($row as $key => $value) {
$data[$header[$key]] = $value;
}
$regionId = $data['region'] != '*' ? $regions[$data['country']][$data['region']] : 0;
try {
$adapter->insert($this->tablerate->getMainTable(), ['website_id' => $this->storeManager->getWebsite()->getId(), 'dest_country_id' => $data['country'], 'dest_region_id' => $regionId, 'dest_zip' => $data['zip'], 'condition_name' => 'package_value', 'condition_value' => $data['order_subtotal'], 'price' => $data['price'], 'cost' => 0]);
} catch (\Zend_Db_Statement_Exception $e) {
if ($e->getCode() == self::ERROR_CODE_DUPLICATE_ENTRY) {
// In case if Sample data was already installed we just skip duplicated records installation
continue;
} else {
throw $e;
}
}
}
}
$this->configWriter->save('carriers/tablerate/active', 1);
$this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
$this->cacheTypeList->cleanType('config');
}
示例14: 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();
}
示例15: 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);
}