本文整理匯總了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));
}