File tree 3 files changed +13
-3
lines changed
lib/Nekland/BaseApi/Cache/Provider
Nekland/BaseApi/Http/ClientAdapter
3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class FileProvider implements CacheProviderInterface
27
27
public function setOptions (array $ options )
28
28
{
29
29
$ this ->options = array_merge ($ this ->getOptions (), $ options );
30
+
30
31
return $ this ;
31
32
}
32
33
@@ -57,9 +58,13 @@ public function get($key)
57
58
public function set ($ key , $ value )
58
59
{
59
60
$ this ->cache [$ key ] = $ value ;
61
+
60
62
return $ this ;
61
63
}
62
64
65
+ /**
66
+ * @return string
67
+ */
63
68
protected function getPath ()
64
69
{
65
70
return $ this ->options ['path ' ];
@@ -74,6 +79,8 @@ protected function getOptions()
74
79
75
80
public function __destruct ()
76
81
{
77
- $ this ->save ();
82
+ if (null !== $ this ->getPath ()) {
83
+ $ this ->save ();
84
+ }
78
85
}
79
86
}
Original file line number Diff line number Diff line change 4
4
5
5
use GuzzleHttp \Client ;
6
6
use GuzzleHttp \Message \MessageInterface ;
7
+ use GuzzleHttp \Message \ResponseInterface ;
7
8
use Nekland \BaseApi \Http \Event \RequestEvent ;
8
9
use Nekland \BaseApi \Http \Request ;
9
10
use PhpSpec \ObjectBehavior ;
@@ -47,10 +48,12 @@ public function it_should_send_real_request_when_event_request_not_completed(
47
48
EventDispatcher $ dispatcher ,
48
49
Request $ request ,
49
50
RequestEvent $ requestEvent ,
50
- MessageInterface $ result
51
+ ResponseInterface $ result
51
52
) {
52
53
$ guzzle ->get ('api.com ' , Argument::any ())->shouldBeCalled ();
53
54
$ guzzle ->get ('api.com ' , Argument::any ())->willReturn ($ result );
55
+ $ result ->getHeaders ()->willReturn ([]);
56
+ $ result ->getBody ()->willReturn ('' );
54
57
55
58
$ requestEvent ->requestCompleted ()->willReturn (false );
56
59
$ dispatcher
Original file line number Diff line number Diff line change 1
- a:1:{s:9:"something";a:2:{i:0;s:3:"foz";i:1;s:3:"baz";}}
1
+ a:1:{s:9:"something";a:2:{i:0;s:3:"foz";i:1;s:3:"baz";}}
You can’t perform that action at this time.
0 commit comments