Skip to content

Commit cb10ecf

Browse files
author
Maksym Savich
committed
MAGETWO-35462: Refactor \Magento\Framework\Model\Resource\Db\AbstractDb only update changed fields
- Failed unit test fix
1 parent 4d367aa commit cb10ecf

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/AbstractDbTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,20 @@ public function testLoad()
278278
{
279279
$contextMock = $this->getMock('\Magento\Framework\Model\Context', [], [], '', false);
280280
$registryMock = $this->getMock('\Magento\Framework\Registry', [], [], '', false);
281+
$resourceMock = $this->getMock('Magento\Framework\Model\Resource\Db\AbstractDb', ['_construct'], [], '', false);
281282
$abstractModelMock = $this->getMockForAbstractClass(
282283
'\Magento\Framework\Model\AbstractModel',
283-
[$contextMock, $registryMock],
284+
[$contextMock, $registryMock, $resourceMock],
284285
'',
285286
false,
286287
true,
287288
true,
288-
['__wakeup']
289+
['__wakeup', 'getResource', '_afterLoad']
289290
);
291+
$abstractModelMock->expects($this->any())
292+
->method('getResource')
293+
->will($this->returnValue($resourceMock));
294+
$abstractModelMock->expects($this->once())->method('_afterLoad');
290295

291296
$value = 'some_value';
292297
$idFieldName = new \ReflectionProperty('Magento\Framework\Model\Resource\Db\AbstractDb', '_idFieldName');
@@ -447,10 +452,7 @@ public function testPrepareDataForUpdate()
447452
'_getReadAdapter',
448453
'_getWriteAdapter',
449454
'__wakeup',
450-
'commit',
451-
'delete',
452-
'getIdFieldName',
453-
'rollBack'
455+
'getIdFieldName'
454456
],
455457
[],
456458
'',

0 commit comments

Comments
 (0)