public function testExecute() { $data = new \DateTime(); $this->localeResolver->expects($this->once())->method('emulate')->with(0); $this->localeDate->expects($this->once())->method('date')->will($this->returnValue($data)); $this->reportRule->expects($this->once())->method('aggregate')->with($data); $this->localeResolver->expects($this->once())->method('revert'); $scheduleMock = $this->getMock('Magento\\Cron\\Model\\Schedule', [], [], '', false); $this->assertEquals($this->model, $this->model->execute($scheduleMock)); }
public function testAggregateSalesReportCouponsData() { $data = new \DateTime(); $this->localeResolver->expects($this->once())->method('emulate')->with(0); $this->localeDate->expects($this->once())->method('date')->will($this->returnValue($data)); $this->reportRule->expects($this->once())->method('aggregate')->with($data); $this->localeResolver->expects($this->once())->method('revert'); $this->assertEquals($this->model, $this->model->aggregateSalesReportCouponsData()); }
public function testAggregateSalesReportCouponsData() { $dateMock = $this->getMock('Magento\\Framework\\Stdlib\\DateTime\\DateInterface', [], [], '', false); $this->localeResolver->expects($this->once())->method('emulate')->with(0); $this->localeDate->expects($this->once())->method('date')->will($this->returnValue($dateMock)); $dateMock->expects($this->once())->method('subHour')->with(25)->will($this->returnSelf()); $this->reportRule->expects($this->once())->method('aggregate')->with($dateMock); $this->localeResolver->expects($this->once())->method('revert'); $this->assertEquals($this->model, $this->model->aggregateSalesReportCouponsData()); }
/** * Set locale * * @param string $locale * @return $this */ public function setLocale($locale = null) { $forceLocale = $this->_request->getParam('locale', null); if (!$this->_localeValidator->isValid($forceLocale)) { $forceLocale = false; } $sessionLocale = $this->_session->getSessionLocale(); $userLocale = $this->_localeManager->getUserInterfaceLocale(); $localeCodes = array_filter([$forceLocale, $sessionLocale, $userLocale]); if (count($localeCodes)) { $locale = reset($localeCodes); } return parent::setLocale($locale); }
/** * Get payment request data as array * * @param \Magento\Paypal\Model\Hostedpro $paymentMethod * @return array */ protected function _getPaymentData(\Magento\Paypal\Model\Hostedpro $paymentMethod) { $request = ['paymentaction' => strtolower($paymentMethod->getConfigData('payment_action')), 'notify_url' => $paymentMethod->getNotifyUrl(), 'cancel_return' => $paymentMethod->getCancelUrl(), 'return' => $paymentMethod->getReturnUrl(), 'lc' => \Locale::getRegion($this->localeResolver->getLocale()), 'template' => 'mobile-iframe', 'showBillingAddress' => 'false', 'showShippingAddress' => 'true', 'showBillingEmail' => 'false', 'showBillingPhone' => 'false', 'showCustomerName' => 'false', 'showCardInfo' => 'true', 'showHostedThankyouPage' => 'false']; return $request; }