/**
  * @param int|null $integrationId
  * @param array $oauthRequest
  * @return void
  */
 public function setupUserId($integrationId, $oauthRequest)
 {
     $integration = $this->getMockBuilder('Magento\\Integration\\Model\\Integration')->disableOriginalConstructor()->setMethods(['getId', '__wakeup'])->getMock();
     $this->integrationService->expects($this->any())->method('findActiveIntegrationByConsumerId')->will($this->returnValue($integration));
     $this->oauthRequestHelper->expects($this->once())->method('prepareRequest')->will($this->returnValue($oauthRequest));
     $this->oauthService->expects($this->any())->method('validateAccessTokenRequest')->will($this->returnValue(1));
     $integration->expects($this->any())->method('getId')->will($this->returnValue($integrationId));
 }
示例#2
0
 /**
  * Test successful SOAP action request dispatch.
  */
 public function testDispatchSoapRequest()
 {
     $this->_appStateMock->expects($this->any())->method('isInstalled')->will($this->returnValue(true));
     $this->_soapServerMock->expects($this->once())->method('handle');
     $this->_oauthServiceMock->expects($this->once())->method('validateAccessToken')->will($this->returnValue(true));
     $response = $this->_soapController->dispatch($this->_requestMock);
     $this->assertEquals(200, $response->getHttpResponseCode());
 }
示例#3
0
 /**
  * @dataProvider dataProviderMissingParamForBuildAuthorizationHeaderTest
  */
 public function testMissingParamForBuildAuthorizationHeader($expectedMessage, $request)
 {
     $this->setExpectedException('\\Magento\\Framework\\Oauth\\OauthInputException', $expectedMessage, 0);
     $requestUrl = 'http://www.example.com/endpoint';
     $this->_oauth->buildAuthorizationHeader($request, $requestUrl);
 }