@@ -77,13 +77,14 @@ public function test_it_can_get_token()
77
77
];
78
78
$ provider = new OAuthTestProviderStub ($ config );
79
79
$ response = m::mock (\Psr \Http \Message \ResponseInterface::class);
80
+ $ stream = m::mock (\Psr \Http \Message \StreamInterface::class);
80
81
81
- $ response ->shouldReceive ('getBody ' )->andReturn ($ response );
82
- $ response ->shouldReceive ('__toString ' )->andReturn (\json_encode ([
82
+ $ stream ->shouldReceive ('__toString ' )->andReturn (\json_encode ([
83
83
'access_token ' => 'fake_access_token ' ,
84
84
'refresh_token ' => 'fake_refresh_token ' ,
85
85
'expires_in ' => 123456 ,
86
86
]));
87
+ $ response ->shouldReceive ('getBody ' )->andReturn ($ stream );
87
88
88
89
$ provider ->getHttpClient ()->shouldReceive ('post ' )->with ('http://token.url ' , [
89
90
'form_params ' => [
@@ -128,12 +129,14 @@ public function test_it_can_get_user_by_code()
128
129
$ provider = new OAuthTestProviderStub ($ config );
129
130
130
131
$ response = m::mock (\Psr \Http \Message \ResponseInterface::class);
131
- $ response ->shouldReceive ('getBody ' )->andReturn ($ response );
132
- $ response ->shouldReceive ('__toString ' )->andReturn (\json_encode ([
132
+ $ stream = m::mock (\Psr \Http \Message \StreamInterface::class);
133
+
134
+ $ stream ->shouldReceive ('__toString ' )->andReturn (\json_encode ([
133
135
'access_token ' => 'fake_access_token ' ,
134
136
'refresh_token ' => 'fake_refresh_token ' ,
135
137
'expires_in ' => 123456 ,
136
138
]));
139
+ $ response ->shouldReceive ('getBody ' )->andReturn ($ stream );
137
140
138
141
$ provider ->getHttpClient ()->shouldReceive ('post ' )->with ('http://token.url ' , [
139
142
'form_params ' => [
0 commit comments