Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek- committed Mar 10, 2015
1 parent 094c2af commit a8d8413
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/Nekland/BaseApi/Cache/Provider/FileProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class FileProvider implements CacheProviderInterface
public function setOptions(array $options)
{
$this->options = array_merge($this->getOptions(), $options);

return $this;
}

Expand Down Expand Up @@ -57,9 +58,13 @@ public function get($key)
public function set($key, $value)
{
$this->cache[$key] = $value;

return $this;
}

/**
* @return string
*/
protected function getPath()
{
return $this->options['path'];
Expand All @@ -74,6 +79,8 @@ protected function getOptions()

public function __destruct()
{
$this->save();
if (null !== $this->getPath()) {
$this->save();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use GuzzleHttp\Client;
use GuzzleHttp\Message\MessageInterface;
use GuzzleHttp\Message\ResponseInterface;
use Nekland\BaseApi\Http\Event\RequestEvent;
use Nekland\BaseApi\Http\Request;
use PhpSpec\ObjectBehavior;
Expand Down Expand Up @@ -47,10 +48,12 @@ public function it_should_send_real_request_when_event_request_not_completed(
EventDispatcher $dispatcher,
Request $request,
RequestEvent $requestEvent,
MessageInterface $result
ResponseInterface $result
) {
$guzzle->get('api.com', Argument::any())->shouldBeCalled();
$guzzle->get('api.com', Argument::any())->willReturn($result);
$result->getHeaders()->willReturn([]);
$result->getBody()->willReturn('');

$requestEvent->requestCompleted()->willReturn(false);
$dispatcher
Expand Down
2 changes: 1 addition & 1 deletion spec/fixture/cache_file
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a:1:{s:9:"something";a:2:{i:0;s:3:"foz";i:1;s:3:"baz";}}
a:1:{s:9:"something";a:2:{i:0;s:3:"foz";i:1;s:3:"baz";}}

0 comments on commit a8d8413

Please sign in to comment.