本文整理汇总了PHP中Magento\Framework\Model\ResourceModel\Db\AbstractDb::hasDataChanged方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractDb::hasDataChanged方法的具体用法?PHP AbstractDb::hasDataChanged怎么用?PHP AbstractDb::hasDataChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\ResourceModel\Db\AbstractDb
的用法示例。
在下文中一共展示了AbstractDb::hasDataChanged方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetDataChanged
/**
* @dataProvider hasDataChangedDataProvider
* @param string $getOriginData
* @param bool $expected
*/
public function testGetDataChanged($getOriginData, $expected)
{
$connectionInterfaceMock = $this->getMock('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface', [], [], '', false);
$this->_resourcesMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionInterfaceMock));
$contextMock = $this->getMock('\\Magento\\Framework\\Model\\Context', [], [], '', false);
$registryMock = $this->getMock('\\Magento\\Framework\\Registry', [], [], '', false);
$abstractModelMock = $this->getMockForAbstractClass('\\Magento\\Framework\\Model\\AbstractModel', [$contextMock, $registryMock], '', false, true, true, ['__wakeup', 'getOrigData', 'getData']);
$mainTableProperty = new \ReflectionProperty('Magento\\Framework\\Model\\ResourceModel\\Db\\AbstractDb', '_mainTable');
$mainTableProperty->setAccessible(true);
$mainTableProperty->setValue($this->_model, 'table');
$this->_resourcesMock->expects($this->once())->method('getTableName')->with('table')->will($this->returnValue('tableName'));
$abstractModelMock->expects($this->at(0))->method('getOrigData')->will($this->returnValue(true));
$abstractModelMock->expects($this->at(1))->method('getOrigData')->will($this->returnValue($getOriginData));
$connectionInterfaceMock->expects($this->any())->method('describeTable')->with('tableName')->will($this->returnValue(['tableName']));
$this->assertEquals($expected, $this->_model->hasDataChanged($abstractModelMock));
}