Ejemplo n.º 1
0
 /**
  * @dataProvider getCcExpDateDataProvider
  */
 public function testGetCcExpDate($ccExpMonth, $ccExpYear)
 {
     $paymentInfo = $this->getMock('Magento\\Payment\\Model\\Info', ['getCcExpMonth', 'getCcExpYear'], [], '', false);
     $paymentInfo->expects($this->any())->method('getCcExpMonth')->will($this->returnValue($ccExpMonth));
     $paymentInfo->expects($this->any())->method('getCcExpYear')->will($this->returnValue($ccExpYear));
     $this->model->setData('info', $paymentInfo);
     $this->localeDate->expects($this->exactly(2))->method('getConfigTimezone')->willReturn('America/Los_Angeles');
     $this->assertEquals($ccExpYear, $this->model->getCcExpDate()->format('Y'));
     $this->assertEquals($ccExpMonth, $this->model->getCcExpDate()->format('m'));
 }
Ejemplo n.º 2
0
 /**
  * @dataProvider getCcExpDateDataProvider
  */
 public function testGetCcExpDate($ccExpMonth, $ccExpYear)
 {
     $paymentInfo = $this->getMock('Magento\\Payment\\Model\\Info', ['getCcExpMonth', 'getCcExpYear'], [], '', false);
     $paymentInfo->expects($this->any())->method('getCcExpMonth')->will($this->returnValue($ccExpMonth));
     $paymentInfo->expects($this->any())->method('getCcExpYear')->will($this->returnValue($ccExpYear));
     $this->model->setData('info', $paymentInfo);
     $date = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface', ['setYear', 'getYear', 'setMonth', 'getMonth', 'getDefaultTimezonePath', 'getDefaultTimezone', 'getDateFormat', 'getDateFormatWithLongYear', 'getTimeFormat', 'getDateTimeFormat', 'date', 'scopeDate', 'utcDate', 'scopeTimeStamp', 'formatDate', 'formatTime', 'getConfigTimezone', 'isScopeDateInInterval'], [], '', false);
     $date->expects($this->any())->method('getYear')->willReturn($ccExpYear);
     $date->expects($this->any())->method('getMonth')->willReturn($ccExpMonth);
     $this->localeDate->expects($this->any())->method('date')->will($this->returnValue($date));
     $this->assertEquals($ccExpYear, $this->model->getCcExpDate()->getYear());
     $this->assertEquals($ccExpMonth, $this->model->getCcExpDate()->getMonth());
 }