15 private $objectManager;
20 private $fetchReports;
25 private $settlementFactoryMock;
30 private $objectManagerMock;
39 $this->objectManagerMock = $this->getMockBuilder(\
Magento\Framework\ObjectManagerInterface::class)
41 $this->settlementFactoryMock = $this->getMockBuilder(\
Magento\Paypal\Model\Report\SettlementFactory::class)
42 ->disableOriginalConstructor()
43 ->setMethods([
'create'])
45 $this->logger = $this->getMockForAbstractClass(\Psr\Log\LoggerInterface::class);
48 $this->fetchReports = $this->objectManager->getObject(
49 \
Magento\Paypal\Cron\FetchReports::class,
51 'settlementFactory' => $this->settlementFactoryMock
62 'hostname' => [
'test_hostname'],
63 'username' => [
'test_username'],
64 'password' => [
'test_password'],
65 'path' => [
'test_path']
67 $settlementMock = $this->getMockBuilder(\
Magento\Paypal\Model\Report\Settlement::class)
68 ->disableOriginalConstructor()
71 $this->settlementFactoryMock->expects($this->once())
73 ->willReturn($settlementMock);
75 $settlementMock->expects($this->once())->method(
'getSftpCredentials')->with(
true)->willReturn($sftpCredentials);
76 $settlementMock->expects($this->any())->method(
'fetchAndSave')->willThrowException(
new \Exception);
77 $this->logger->expects($this->never())->method(
'critical');
79 $this->fetchReports->execute();
testExecuteThrowsException()