public function testSuccess() { $payuplOrderId = 'ABC'; $orderId = 1; $resultRedirect = $this->getRedirectMock('orba_payupl/payment/repeat_start'); $this->resultRedirectFactory->expects($this->once())->method('create')->willReturn($resultRedirect); $request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)->getMockForAbstractClass(); $request->expects($this->once())->method('getParam')->with('id')->willReturn($payuplOrderId); $this->context->expects($this->once())->method('getRequest')->willReturn($request); $this->paymentHelper->expects($this->once())->method('getOrderIdIfCanRepeat')->with($payuplOrderId)->willReturn($orderId); $this->session->expects($this->once())->method('setLastOrderId')->with($orderId); $this->assertEquals($resultRedirect, $this->controller->execute()); }
public function checkAlarm() { $getStartdate = strtotime($this->getStartofTheWeek()); $getEnddate = strtotime($this->getEndofTheWeek()); $start = $this->getStartDayDB($getStartdate); $end = $this->getEndDayDB($getEnddate); $addWhereSql = ''; $aExec = array('1', 'VJOURNAL'); foreach ($this->aCalendars as $calInfo) { if ($addWhereSql == '') { $addWhereSql = "`calendarid` = ? "; array_push($aExec, $calInfo['id']); } else { $addWhereSql .= "OR `calendarid` = ? "; array_push($aExec, $calInfo['id']); } //\OCP\Util::writeLog('calendar','AlarmDB ID :'.$calInfo['id'] ,\OCP\Util::DEBUG); } if ($addWhereSql != '') { $addWhereSql = "AND (" . $addWhereSql . ") "; } $stmt = \OCP\DB::prepare('SELECT * FROM `' . App::CldObjectTable . '` WHERE `isalarm` = ? AND `objecttype`!= ? ' . $addWhereSql . ' ' . ' AND ((`startdate` >= ? AND `enddate` <= ? AND `repeating` = 0)' . ' OR (`enddate` >= ? AND `startdate` <= ? AND `repeating` = 0)' . ' OR (`startdate` <= ? AND `repeating` = 1) )'); array_push($aExec, $start, $end, $start, $end, $start); $result = $stmt->execute($aExec); $calendarobjects = array(); while ($row = $result->fetchRow()) { if ($row['repeating']) { $cachedinperiod = Repeat::get_inperiod_Alarm($row['id'], $start, $end); $rowRepeat = array(); foreach ($cachedinperiod as $cachedevent) { $rowRepeat['startdate'] = $cachedevent['startdate']; $rowRepeat['enddate'] = $cachedevent['enddate']; $rowRepeat['calendardata'] = $row['calendardata']; $rowRepeat['id'] = $row['id']; $rowRepeat['summary'] = $row['summary']; $calendarobjects[] = $rowRepeat; } } $calendarobjects[] = $row; } if (is_array($calendarobjects)) { $this->parseAlarm($calendarobjects); } else { return false; } }