Skip to content

Commit ae9c6a0

Browse files
author
Cari Spruiell
committed
Merge branch 'MAGETWO-18122-Fix-TODOs' of github.scm.corp.ebay.com:magento-api/magento2ce into MAGETWO-18122-Fix-TODOs
2 parents d193254 + 2aebb99 commit ae9c6a0

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

app/code/Magento/Integration/Model/Oauth/Token/Provider.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,33 @@ class Provider implements TokenProviderInterface
3636
*/
3737
protected $token;
3838

39+
/**
40+
* @var \Magento\Framework\Logger
41+
*/
42+
protected $logger;
43+
3944
/**
4045
* @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory
4146
* @param \Magento\Integration\Model\Oauth\Token\Factory $tokenFactory
4247
* @param \Magento\Integration\Helper\Oauth\Data $dataHelper
4348
* @param \Magento\Framework\Stdlib\DateTime\DateTime $date
4449
* @param Token $token
50+
* @param \Magento\Framework\Logger $logger
4551
*/
4652
public function __construct(
4753
\Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory,
4854
\Magento\Integration\Model\Oauth\Token\Factory $tokenFactory,
4955
\Magento\Integration\Helper\Oauth\Data $dataHelper,
5056
\Magento\Framework\Stdlib\DateTime\DateTime $date,
51-
Token $token
57+
Token $token,
58+
\Magento\Framework\Logger $logger
5259
) {
5360
$this->_consumerFactory = $consumerFactory;
5461
$this->_tokenFactory = $tokenFactory;
5562
$this->_dataHelper = $dataHelper;
5663
$this->_date = $date;
5764
$this->token = $token;
65+
$this->logger = $logger;
5866
}
5967

6068
/**
@@ -119,8 +127,8 @@ public function validateRequestToken($requestToken, $consumer, $oauthVerifier)
119127
*/
120128
public function getAccessToken($consumer)
121129
{
122-
/** TODO: log the request token in dev mode since its not persisted. */
123130
$token = $this->getIntegrationTokenByConsumerId($consumer->getId());
131+
$this->logger->log('Request token: ' . $token->getToken());
124132
if (Token::TYPE_REQUEST != $token->getType()) {
125133
throw new \Magento\Framework\Oauth\Exception(
126134
'Cannot get access token because consumer token is not a request token'

app/code/Magento/Integration/Service/V1/Oauth.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
/**
1616
* Integration oAuth service.
1717
*
18-
* TODO: Fix coupling between objects
1918
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2019
*/
2120
class Oauth implements OauthInterface

dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ class OauthTest extends \PHPUnit_Framework_TestCase
3939
/** @var \Magento\Framework\Stdlib\DateTime\DateTime */
4040
private $_dateMock;
4141

42+
/**
43+
* @var \Magento\Framework\Logger
44+
*/
45+
private $_loggerMock;
46+
4247
private $_oauthToken;
4348

4449
private $_oauthSecret;
@@ -112,6 +117,9 @@ public function setUp()
112117
$this->_dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\DateTime')
113118
->disableOriginalConstructor()
114119
->getMock();
120+
$this->_loggerMock = $this->getMockBuilder('Magento\Framework\Logger')
121+
->disableOriginalConstructor()
122+
->getMock();
115123

116124
$nonceGenerator = new \Magento\Integration\Model\Oauth\Nonce\Generator(
117125
$this->_oauthHelperMock,
@@ -123,7 +131,8 @@ public function setUp()
123131
$this->_tokenFactory,
124132
$this->_dataHelperMock,
125133
$this->_dateMock,
126-
$this->_tokenMock
134+
$this->_tokenMock,
135+
$this->_loggerMock
127136
);
128137
$this->_oauth = new \Magento\Framework\Oauth\Oauth(
129138
$this->_oauthHelperMock,

0 commit comments

Comments
 (0)