Skip to content

Commit

Permalink
Merge pull request #16 from KdR88/empty-dir-patch
Browse files Browse the repository at this point in the history
Listcontents implementation adhere to interface
  • Loading branch information
vyuldashev authored Jan 5, 2018
2 parents 9c0d5f4 + bcbfbae commit 41aba8e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/CurlFtpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ protected function listDirectoryContents($directory, $recursive = false)
$connection = $this->getConnection();
$result = $connection->exec([CURLOPT_CUSTOMREQUEST => $request]);
if ($result === false) {
return false;
return [];
}

if ($directory === '/') {
Expand Down
10 changes: 10 additions & 0 deletions tests/CurlFtpAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ public function testListContents($path)
$this->assertCount(1, $this->adapter->listContents(dirname($path)));
}

/**
* @dataProvider withSubFolderProvider
*
* @param $path
*/
public function testListContentsEmptyPath($path)
{
$this->assertCount(0, $this->adapter->listContents(dirname($path)));
}

public function filesProvider()
{
return [
Expand Down
2 changes: 1 addition & 1 deletion tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ error_test()

# creating directory for resources
if test ! -d "tests/resources"; then
mkdir -m=0777 "tests/resources"
mkdir -m 0777 "tests/resources"
if test $? != 0; then exit 1; fi
fi

Expand Down

0 comments on commit 41aba8e

Please sign in to comment.