Fix for the isDir function in the FTP Adapter#607
Conversation
…xception. Also move the URL creation to a private method.
Romain
left a comment
There was a problem hiding this comment.
I created a private method for the connection URL.
I also kept the chdir method as the main approach and fallback on is_dir with passive mode set to true if we catch and exception with chdir.
nicolasmure
left a comment
There was a problem hiding this comment.
Thanks for the update ;)
|
@nicolasmure I pushed a fix with your comments applied in it. |
nicolasmure
left a comment
There was a problem hiding this comment.
Can you also squash your commits please ? :)
|
@nicolasmure Got it. Pushed a change accordingly to your comment. |
nicolasmure
left a comment
There was a problem hiding this comment.
Thanks for the changes :)
There are also some failing tests, do you mind to fix them ?
phpunit :
There were 2 failures:
1) Gaufrette\Functional\Adapter\FtpTest::shouldCheckIfFileExists
Failed asserting that true is false.
/home/travis/build/KnpLabs/Gaufrette/tests/Gaufrette/Functional/Adapter/FunctionalTestCase.php:91
2) Gaufrette\Functional\Adapter\FtpTest::shouldFailWhenTryMtimeForKeyWhichDoesNotExist
Failed asserting that 1561017417 is false.
/home/travis/build/KnpLabs/Gaufrette/tests/Gaufrette/Functional/Adapter/FunctionalTestCase.php:119
and also the phpspec for this adapter.
You can run the specs with
$ docker/run-task php7.2 vendor/bin/phpspec run spec/Gaufrette/Adapter/Ftp.phpand the integration tests with
$ docker/run-task php7.2 vendor/bin/phpunit tests/Gaufrette/Functional/Adapter/FtpTest.php|
Your comments have been integrated. These are nice improvements. ;) |
nicolasmure
left a comment
There was a problem hiding this comment.
Can you also update the tests accordingly please ?
|
@nicolasmure I'm not sure how to update the tests since they're not checking the way we connect to the server. |
The isDir function seems to be broken in the FTP Adapter.
When I try to retrieve a document through a stream, I get this error:
ftp_chdir(): /documents/your-file-name.jpg: No such file or directoryHere is the complete trace:
Changing the way we perform this test by using the PHP function
is_dirinstead of theftp_chdirone fixes this error.