Пример #1
0
 /**
  * @dataProvider beforeSaveProvider
  * @param array $testData
  * @param array $expectedData
  * @return void
  */
 public function testBeforeSave($testData, $expectedData)
 {
     $this->_object->addData($testData);
     $objectMock = $this->mockResource('xcom_ebay/policy', array('beginTransaction', 'addCommitCallback', 'save'));
     $objectMock->expects($this->once())->method('addCommitCallback')->will($this->returnValue(new Xcom_Ebay_Model_PolicyTest_Adapter()));
     $this->_object->save();
     $this->assertEquals($expectedData, $this->_object->getData());
 }
Пример #2
0
 /**
  * @param array $testData
  * @dataProvider afterSaveProvider
  */
 public function testAfterSave($testData)
 {
     $testObject = new Xcom_Ebay_Model_Policy();
     $testObject->addData($testData);
     $tableName = Mage::getModel('core/resource')->getTableName('xcom_ebay/channel_policy');
     $adaptorMock = $this->getMock('Varien_Db_Adapter_Pdo_MysqlFixture', array('insertOnDuplicate'), array(), '', false);
     $adaptorMock->expects($this->any())->method('insertOnDuplicate')->with($this->equalTo($tableName), $this->equalTo($testData), $this->equalTo(array_keys($testData)));
     $objectMock = $this->getMock('Xcom_Ebay_Model_Resource_PolicyFixture', array('_getWriteAdapter', '_cleanPolicyShipping', 'savePolicyShipping', '_prepareDataForTable'));
     $objectMock->expects($this->any())->method('_getWriteAdapter')->will($this->returnValue($adaptorMock));
     $objectMock->expects($this->any())->method('_prepareDataForTable')->will($this->returnValue($testData));
     $objectMock->afterSave($testObject);
 }