Skip to content

Commit

Permalink
Merge pull request #572 from teohhanhui/fix/flysystem-adapter-exists
Browse files Browse the repository at this point in the history
Ensure correct return type from Flysystem adapter "exists" method
  • Loading branch information
nicolasmure committed May 29, 2018
2 parents 827dc53 + 5be9eae commit dd0d2e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions spec/Gaufrette/Adapter/FlysystemSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ function it_checks_if_file_exists(AdapterInterface $adapter)
$this->exists('filename')->shouldReturn(true);
}

function it_checks_if_file_exists_when_flysystem_returns_array(AdapterInterface $adapter)
{
$adapter->has('filename')->willReturn(['type' => 'file']);

$this->exists('filename')->shouldReturn(true);
}

function it_fetches_keys(AdapterInterface $adapter)
{
$adapter->listContents()->willReturn([[
Expand Down
2 changes: 1 addition & 1 deletion src/Gaufrette/Adapter/Flysystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function write($key, $content)
*/
public function exists($key)
{
return $this->adapter->has($key);
return (bool) $this->adapter->has($key);
}

/**
Expand Down

0 comments on commit dd0d2e9

Please sign in to comment.