7
7
8
8
namespace Magento \Integration \Test \Unit \Oauth ;
9
9
10
- use Laminas \ OAuth \ Http \Utility ;
10
+ use Magento \ Framework \ Oauth \ Helper \Utility ;
11
11
use Magento \Framework \DataObject ;
12
12
use Magento \Framework \Math \Random ;
13
13
use Magento \Framework \Oauth \Helper \Oauth ;
@@ -56,7 +56,7 @@ class OauthTest extends TestCase
56
56
private $ _oauth ;
57
57
58
58
/** @var \Zend_Oauth_Http_Utility */
59
- private $ _httpUtilityMock ;
59
+ private $ utility ;
60
60
61
61
/** @var DateTime */
62
62
private $ _dateMock ;
@@ -160,7 +160,7 @@ protected function setUp(): void
160
160
$ this ->_oauthHelperMock = $ this ->getMockBuilder (Oauth::class)
161
161
->setConstructorArgs ([new Random ()])
162
162
->getMock ();
163
- $ this ->_httpUtilityMock = $ this ->getMockBuilder (Utility::class)
163
+ $ this ->utility = $ this ->getMockBuilder (Utility::class)
164
164
->onlyMethods (['sign ' ])
165
165
->getMock ();
166
166
$ this ->_dateMock = $ this ->getMockBuilder (DateTime::class)
@@ -190,7 +190,7 @@ protected function setUp(): void
190
190
$ this ->_oauthHelperMock ,
191
191
$ nonceGenerator ,
192
192
$ tokenProvider ,
193
- $ this ->_httpUtilityMock
193
+ $ this ->utility
194
194
);
195
195
$ this ->_oauthToken = $ this ->_generateRandomString (Oauth::LENGTH_TOKEN );
196
196
$ this ->_oauthSecret = $ this ->_generateRandomString (Oauth::LENGTH_TOKEN_SECRET );
@@ -199,17 +199,6 @@ protected function setUp(): void
199
199
);
200
200
}
201
201
202
- protected function tearDown (): void
203
- {
204
- unset($ this ->_consumerFactory );
205
- unset($ this ->_nonceFactory );
206
- unset($ this ->_tokenFactory );
207
- unset($ this ->_oauthHelperMock );
208
- unset($ this ->_httpUtilityMock );
209
- unset($ this ->_dateMock );
210
- unset($ this ->_oauth );
211
- }
212
-
213
202
/**
214
203
* @param array $amendments
215
204
* @return array
@@ -477,7 +466,7 @@ public function testGetRequestTokenTokenRejected()
477
466
$ this ->_setupToken (false );
478
467
479
468
$ signature = 'valid_signature ' ;
480
- $ this ->_httpUtilityMock ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
469
+ $ this ->utility ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
481
470
482
471
$ this ->_oauth ->getRequestToken (
483
472
$ this ->_getRequestTokenParams (['oauth_signature ' => $ signature ]),
@@ -498,7 +487,7 @@ public function testGetRequestTokenTokenRejectedByType()
498
487
// wrong type
499
488
500
489
$ signature = 'valid_signature ' ;
501
- $ this ->_httpUtilityMock ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
490
+ $ this ->utility ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
502
491
503
492
$ this ->_oauth ->getRequestToken (
504
493
$ this ->_getRequestTokenParams (['oauth_signature ' => $ signature ]),
@@ -548,7 +537,7 @@ public function testGetRequestToken()
548
537
$ this ->_setupToken ();
549
538
550
539
$ signature = 'valid_signature ' ;
551
- $ this ->_httpUtilityMock ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
540
+ $ this ->utility ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
552
541
553
542
$ requestToken = $ this ->_oauth ->getRequestToken (
554
543
$ this ->_getRequestTokenParams (['oauth_signature ' => $ signature ]),
@@ -802,7 +791,7 @@ public function testValidateAccessToken()
802
791
public function testBuildAuthorizationHeader ()
803
792
{
804
793
$ signature = 'valid_signature ' ;
805
- $ this ->_httpUtilityMock ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
794
+ $ this ->utility ->expects ($ this ->any ())->method ('sign ' )->willReturn ($ signature );
806
795
807
796
$ this ->_setupConsumer (false );
808
797
$ this ->_oauthHelperMock ->expects (
0 commit comments