Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bushbaby/BsbFlysystem
Browse files Browse the repository at this point in the history
# By Didier Belot
# Via Bas Kamer (1) and Didier Belot (1)
* 'master' of github.com:bushbaby/BsbFlysystem:
  sftp options, adjusting tests
  Allowing no password option if privateKey is set
  • Loading branch information
basz committed Apr 2, 2015
2 parents f0186ee + af243dc commit 0badec3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Adapter/Factory/SftpAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ protected function validateConfig()
throw new UnexpectedValueException("Missing 'username' as option");
}

if (!isset($this->options['password'])) {
throw new UnexpectedValueException("Missing 'password' as option");
if (!isset($this->options['password']) && !isset($this->options['privateKey'])) {
throw new UnexpectedValueException("Missing either 'password' or 'privateKey' as option");
}
}
}
6 changes: 5 additions & 1 deletion test/Adapter/Factory/SftpAdapterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ public function validateConfigProvider()
['host' => 'foo', 'port' => 'foo', 'username' => 'foo'],
false,
'UnexpectedValueException',
"Missing 'password' as option"
"Missing either 'password' or 'privateKey' as option"
],
[
['host' => 'foo', 'port' => 'foo', 'username' => 'foo', 'password' => 'foo'],
['host' => 'foo', 'port' => 'foo', 'username' => 'foo', 'password' => 'foo'],
],
[
['host' => 'foo', 'port' => 'foo', 'username' => 'foo', 'privateKey' => 'foo'],
['host' => 'foo', 'port' => 'foo', 'username' => 'foo', 'privateKey' => 'foo'],
],
];
}
}

0 comments on commit 0badec3

Please sign in to comment.