/**
  * Test case for oePayPalOrderPayment::hasPendingPayment()
  * Checks if list has pending payments
  *
  * @return null
  */
 public function testAddComment()
 {
     $oList = new oePayPalOrderPaymentCommentList();
     $oList->load('payment');
     $this->assertEquals(0, count($oList));
     $oComment = new oePayPalOrderPaymentComment();
     $oComment->setPaymentId('payment');
     $oComment->save();
     $oList = new oePayPalOrderPaymentCommentList();
     $oList->load('payment');
     $this->assertEquals(1, count($oList));
     $oComment = new oePayPalOrderPaymentComment();
     $oComment->setComment('Comment');
     $oList->addComment($oComment);
     $oList = new oePayPalOrderPaymentCommentList();
     $oList->load('payment');
     $this->assertEquals(2, count($oList));
 }
 /**
  * Testing saving of order after updating it
  */
 public function testProcess_CommentAdded()
 {
     $oUtilsDate = $this->getMock('oxUtilsDate', array('getTime'));
     $oUtilsDate->expects($this->any())->method('getTime')->will($this->returnValue(time()));
     oxRegistry::set('oxUtilsDate', $oUtilsDate);
     $sComment = 'testComment';
     $oComment = new oePayPalOrderPaymentComment();
     $oComment->setComment($sComment);
     $oPayPalResponse = $this->_getPayPalResponse();
     $oPayment = $this->_getPayment();
     $oPayment->expects($this->once())->method('addComment')->with($this->equalTo($oComment));
     $oPaymentList = $this->_getPaymentList(array('addPayment'));
     $oPaymentList->expects($this->any())->method('addPayment')->will($this->returnValue($oPayment));
     $oOrder = $this->_getOrder(array('getPaymentList', 'getRemainingOrderSum'));
     $oOrder->expects($this->once())->method('getPaymentList')->will($this->returnValue($oPaymentList));
     $oData = $this->_getData();
     $oData->expects($this->any())->method('getComment')->will($this->returnValue($sComment));
     $oAction = $this->_getAction($oPayPalResponse, $oOrder, $oData);
     $oAction->process();
 }
 /**
  * Test case add comment to payment
  */
 public function testAddComment_NoDateGiven()
 {
     $oOrderPayment = new oePayPalOrderPayment();
     $oOrderPayment->setOrderId('123');
     $oOrderPayment->save();
     $this->assertEquals(0, count($oOrderPayment->getCommentList()), 'No comments - default value empty array.');
     $oComment = new oePayPalOrderPaymentComment();
     $oComment->setComment('comment');
     $oOrderPayment->addComment($oComment);
     $this->assertEquals(1, count($oOrderPayment->getCommentList()));
 }
 /**
  * Test case for oePayPalPayPalOrder::save()
  * Tests adding / getting PayPal Order Payment history item
  *
  * @return null
  */
 public function testSavePayPalPayPalOrder_update()
 {
     $oComment = new oePayPalOrderPaymentComment();
     $oComment->setCommentId(10);
     $oComment->setDate('2013-02-03 12:12:12');
     $oComment->setComment('comment');
     $oComment->setPaymentId(2);
     $oComment->save();
     $oCommentLoaded = new oePayPalOrderPaymentComment();
     $oCommentLoaded->load(10);
     $oCommentLoaded->setComment('comment comment');
     $id = $oCommentLoaded->save();
     $this->assertEquals(10, $id);
     $oCommentLoaded = new oePayPalOrderPaymentComment();
     $oCommentLoaded->load(10);
     $this->assertEquals(10, $oCommentLoaded->getCommentId());
     $this->assertEquals('comment comment', $oCommentLoaded->getComment());
     $this->assertEquals(2, $oCommentLoaded->getPaymentId());
     $this->assertEquals('2013-02-03 12:12:12', $oCommentLoaded->getDate());
 }