File tree Expand file tree Collapse file tree 6 files changed +20
-16
lines changed Expand file tree Collapse file tree 6 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 10
10
"email" : " jerome@gamez.name"
11
11
}
12
12
],
13
- "require-dev " : {
13
+ "require" : {
14
14
"php" : " ^5.6|^7.0" ,
15
15
"php-http/plugins" : " ^1.0" ,
16
+ "guzzlehttp/psr7" : " ^1.2"
17
+ },
18
+ "require-dev" : {
16
19
"phpunit/phpunit" : " ^5.2" ,
17
- "guzzlehttp/psr7" : " ^1.2" ,
18
20
"mikey179/vfsStream" : " ^1.6"
19
21
},
20
- "autoload-dev " : {
22
+ "autoload" : {
21
23
"psr-4" : {
22
24
"Http\\ Client\\ Plugin\\ Vcr\\ " : " src"
23
25
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Http \Client \Plugin \Vcr ;
4
4
5
- use Http \Client \Plugin \Plugin ;
5
+ use Http \Client \Common \Plugin ;
6
6
use Http \Client \Plugin \Vcr \Exception \CannotBeReplayed ;
7
7
use Http \Client \Plugin \Vcr \Exception \NotFound ;
8
8
use Http \Promise \FulfilledPromise ;
13
13
class VcrPlugin implements Plugin
14
14
{
15
15
const HEADER_VCR = 'X-VCR ' ;
16
+
16
17
const HEADER_VCR_REPLAY = 'replay ' ;
18
+
17
19
const HEADER_VCR_RECORDED = 'recorded ' ;
18
20
19
21
/**
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ class TrackTest extends VcrTestCase
33
33
34
34
protected function setUp ()
35
35
{
36
- $ this ->request = $ this ->getMock (RequestInterface::class);
37
- $ this ->response = $ this ->getMock (ResponseInterface::class);
36
+ $ this ->request = $ this ->createMock (RequestInterface::class);
37
+ $ this ->response = $ this ->createMock (ResponseInterface::class);
38
38
$ this ->exception = new \Exception ();
39
39
40
40
$ this ->track = Track::create ($ this ->request );
@@ -69,7 +69,7 @@ public function testWithException()
69
69
70
70
public function testResponseBodyIsRewound ()
71
71
{
72
- $ body = $ this ->getMock (StreamInterface::class);
72
+ $ body = $ this ->createMock (StreamInterface::class);
73
73
$ this ->response ->expects ($ this ->once ())->method ('getBody ' )->willReturn ($ body );
74
74
75
75
$ this ->track ->setResponse ($ this ->response );
Original file line number Diff line number Diff line change @@ -28,15 +28,15 @@ class VcrClientTest extends VcrTestCase
28
28
29
29
protected function setUp ()
30
30
{
31
- $ this ->vcr = $ this ->getMockBuilder (Vcr::class)-> getMock ( );
32
- $ this ->client = $ this ->getMock (ClientImplementation::class);
31
+ $ this ->vcr = $ this ->createMock (Vcr::class);
32
+ $ this ->client = $ this ->createMock (ClientImplementation::class);
33
33
$ this ->vcrClient = new VcrClient ($ this ->client , $ this ->vcr );
34
34
}
35
35
36
36
public function testSendRequest ()
37
37
{
38
- $ request = $ this ->getMock (RequestInterface::class);
39
- $ response = $ this ->getMock (ResponseInterface::class);
38
+ $ request = $ this ->createMock (RequestInterface::class);
39
+ $ response = $ this ->createMock (ResponseInterface::class);
40
40
41
41
$ this ->client ->expects ($ this ->once ())->method ('sendRequest ' )->with ($ request )->willReturn ($ response );
42
42
@@ -45,8 +45,8 @@ public function testSendRequest()
45
45
46
46
public function testSendAsyncRequest ()
47
47
{
48
- $ request = $ this ->getMock (RequestInterface::class);
49
- $ response = $ this ->getMock (ResponseInterface::class);
48
+ $ request = $ this ->createMock (RequestInterface::class);
49
+ $ response = $ this ->createMock (ResponseInterface::class);
50
50
$ fulfilledPromise = new FulfilledPromise ($ response );
51
51
52
52
$ this ->client ->expects ($ this ->once ())->method ('sendAsyncRequest ' )->with ($ request )->willReturn ($ fulfilledPromise );
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class VcrPluginTest extends VcrTestCase
41
41
42
42
protected function setUp ()
43
43
{
44
- $ this ->request = $ this ->getMock (RequestInterface::class);
44
+ $ this ->request = $ this ->createMock (RequestInterface::class);
45
45
46
46
$ this ->track = $ this ->getMockBuilder (Track::class)->disableOriginalConstructor ()->getMock ();
47
47
$ this ->track
@@ -103,7 +103,7 @@ public function testReplayException()
103
103
104
104
$ promise = $ this ->plugin ->handleRequest (
105
105
$ this ->request ,
106
- $ this ->fulfilledPromise ($ this ->getMock (ResponseInterface::class)),
106
+ $ this ->fulfilledPromise ($ this ->createMock (ResponseInterface::class)),
107
107
$ this ->rejectedPromise ($ exception )
108
108
);
109
109
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class VcrTest extends VcrTestCase
27
27
28
28
protected function setUp ()
29
29
{
30
- $ this ->storage = $ this ->getMock (Storage::class);
30
+ $ this ->storage = $ this ->createMock (Storage::class);
31
31
$ this ->tape = $ this ->getMockBuilder (Tape::class)->disableOriginalConstructor ()->getMock ();
32
32
33
33
$ this ->vcr = Vcr::createWithStorage ($ this ->storage );
You can’t perform that action at this time.
0 commit comments