protected function setUp()
 {
     $this->store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $storeManager = $this->getMock('Magento\\Framework\\StoreManagerInterface');
     $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
     $this->paypalConfig = $this->getMock('Magento\\Paypal\\Model\\Config', [], [], '', false);
     $configFactory = $this->getMock('Magento\\Paypal\\Model\\ConfigFactory', ['create']);
     $configFactory->expects($this->any())->method('create')->will($this->returnValue($this->paypalConfig));
     $this->payflowRequest = $this->getMock('Magento\\Paypal\\Model\\Payflow\\Request', [], [], '', false);
     $this->payflowRequest->expects($this->any())->method('__call')->will($this->returnCallback(function ($method) {
         if (strpos($method, 'set') === 0) {
             return $this->payflowRequest;
         }
         return null;
     }));
     $requestFactory = $this->getMock('Magento\\Paypal\\Model\\Payflow\\RequestFactory', ['create']);
     $requestFactory->expects($this->any())->method('create')->will($this->returnValue($this->payflowRequest));
     $this->infoInstance = $this->getMock('Magento\\Sales\\Model\\Order\\Payment', [], [], '', false);
     $client = $this->getMock('Magento\\Framework\\HTTP\\ZendClient', ['setUri', 'setConfig', 'setMethod', 'setParameterPost', 'setHeaders', 'setUrlEncodeBody', 'request', 'getBody'], [], '', false);
     $client->expects($this->any())->method('create')->will($this->returnSelf());
     $client->expects($this->any())->method('setUri')->will($this->returnSelf());
     $client->expects($this->any())->method('setConfig')->will($this->returnSelf());
     $client->expects($this->any())->method('setMethod')->will($this->returnSelf());
     $client->expects($this->any())->method('setParameterPost')->will($this->returnSelf());
     $client->expects($this->any())->method('setHeaders')->will($this->returnSelf());
     $client->expects($this->any())->method('setUrlEncodeBody')->will($this->returnSelf());
     $client->expects($this->any())->method('request')->will($this->returnSelf());
     $client->expects($this->any())->method('getBody')->will($this->returnValue('RESULT name=value&name2=value2'));
     $clientFactory = $this->getMock('Magento\\Framework\\HTTP\\ZendClientFactory', ['create'], [], '', false);
     $clientFactory->expects($this->any())->method('create')->will($this->returnValue($client));
     $helper = new ObjectManagerHelper($this);
     $this->model = $helper->getObject('Magento\\Paypal\\Model\\Payflowlink', ['storeManager' => $storeManager, 'configFactory' => $configFactory, 'requestFactory' => $requestFactory, 'httpClientFactory' => $clientFactory]);
     $this->model->setInfoInstance($this->infoInstance);
 }
Ejemplo n.º 2
0
 protected function setUp()
 {
     $this->store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $storeManager = $this->getMock('Magento\\Store\\Model\\StoreManagerInterface');
     $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
     $this->paypalConfig = $this->getMock('Magento\\Paypal\\Model\\Config', [], [], '', false);
     $configFactory = $this->getMock('Magento\\Paypal\\Model\\ConfigFactory', ['create']);
     $configFactory->expects($this->any())->method('create')->will($this->returnValue($this->paypalConfig));
     $this->payflowRequest = $this->getMock('Magento\\Paypal\\Model\\Payflow\\Request', [], [], '', false);
     $this->payflowRequest->expects($this->any())->method('__call')->will($this->returnCallback(function ($method) {
         if (strpos($method, 'set') === 0) {
             return $this->payflowRequest;
         }
         return null;
     }));
     $requestFactory = $this->getMock('Magento\\Paypal\\Model\\Payflow\\RequestFactory', ['create']);
     $requestFactory->expects($this->any())->method('create')->will($this->returnValue($this->payflowRequest));
     $this->infoInstance = $this->getMock('Magento\\Sales\\Model\\Order\\Payment', [], [], '', false);
     $helper = new ObjectManagerHelper($this);
     $this->model = $helper->getObject('Magento\\Paypal\\Model\\Payflowlink', ['storeManager' => $storeManager, 'configFactory' => $configFactory, 'requestFactory' => $requestFactory]);
     $this->model->setInfoInstance($this->infoInstance);
 }
Ejemplo n.º 3
0
 protected function setUp()
 {
     $this->store = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false);
     $storeManager = $this->getMock('Magento\\Store\\Model\\StoreManagerInterface');
     $this->paypalConfig = $this->getMockBuilder('Magento\\Paypal\\Model\\Config')->disableOriginalConstructor()->getMock();
     $configFactoryMock = $this->getMockBuilder('Magento\\Payment\\Model\\Method\\ConfigInterfaceFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $requestFactory = $this->getMockBuilder('Magento\\Paypal\\Model\\Payflow\\RequestFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $this->payflowRequest = $this->getMockBuilder('Magento\\Paypal\\Model\\Payflow\\Request')->disableOriginalConstructor()->getMock();
     $this->infoInstance = $this->getMockBuilder('Magento\\Sales\\Model\\Order\\Payment')->disableOriginalConstructor()->getMock();
     $this->scopeConfigMock = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->getMockForAbstractClass();
     $this->gatewayMock = $this->getMockBuilder('Magento\\Paypal\\Model\\Payflow\\Service\\Gateway')->disableOriginalConstructor()->getMock();
     $storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
     $configFactoryMock->expects($this->any())->method('create')->willReturn($this->paypalConfig);
     $this->payflowRequest->expects($this->any())->method('__call')->will($this->returnCallback(function ($method) {
         if (strpos($method, 'set') === 0) {
             return $this->payflowRequest;
         }
         return null;
     }));
     $requestFactory->expects($this->any())->method('create')->will($this->returnValue($this->payflowRequest));
     $helper = new ObjectManagerHelper($this);
     $this->model = $helper->getObject('Magento\\Paypal\\Model\\Payflowlink', ['scopeConfig' => $this->scopeConfigMock, 'storeManager' => $storeManager, 'configFactory' => $configFactoryMock, 'requestFactory' => $requestFactory, 'gateway' => $this->gatewayMock]);
     $this->model->setInfoInstance($this->infoInstance);
 }