Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StorageFailure and FileNotFound exceptions for Flysystem adapter #519

Merged
merged 1 commit into from
Jul 11, 2017

Conversation

nicolasmure
Copy link
Contributor

Related to #497 .

To be complient with the new Adapter implementation, the adapter throws a StorageFailure exeption instead of returning false if the original adapter returns false in case of failure.

{
$adapter->read('filename')->willThrow(new FileNotFoundException('filename'));

$this->shouldThrow('Gaufrette\Exception\FileNotFound')->duringread('filename');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the lower "r" a mistake or is it due to the pretty old version of phpspec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks surprising but yes, it's because of an old version of phpspec (2.4). BTW I ran into issues when trying to run the phpspec tests : the phpspec.yml file has a dependency on Akeneo\SkipExampleExtension but I couldn't get it installed via composer (unresolvable set of packages). So I had to comment that file to run the tests on my machine 😕 . I'm still wondering how the tests can be executed on the CI .

It would be a good point to bump up the tests tools to their latest version 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into issues when trying to run the phpspec tests : the phpspec.yml file has a dependency on Akeneo\SkipExampleExtension but I couldn't get it installed via composer (unresolvable set of packages). So I had to comment that file to run the tests on my machine 😕

Mh, that's strange! The akeneo/phpspec-skip-example-extension package is in our composer.json for some time now. Was there any error message/stacktrace?

It would be a good point to bump up the tests tools to their latest version 😉

Yep, I already upgraded phpunit to 5.7 and there's a task about upgrading phpspec in the github project ;)

Copy link
Contributor Author

@nicolasmure nicolasmure Jul 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no error during composer install, but the akeneo directory was not present in the vendor. However, when trying to manually install the package, I got the following error :

$ composer require --dev akeneo/phpspec-skip-example-extension
Using version ^3.0@dev for akeneo/phpspec-skip-example-extension
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - akeneo/phpspec-skip-example-extension 3.0.x-dev requires phpspec/phpspec ^4.0 -> satisfiable by phpspec/phpspec[4.0.x-dev].
    - akeneo/phpspec-skip-example-extension v3.0.0-alpha1 requires phpspec/phpspec ^4.0 -> satisfiable by phpspec/phpspec[4.0.x-dev].
    - Conclusion: don't install phpspec/phpspec 4.0.x-dev
    - Installation request for akeneo/phpspec-skip-example-extension ^3.0@dev -> satisfiable by akeneo/phpspec-skip-example-extension[3.0.x-dev, v3.0.0-alpha1].


Installation failed, reverting ./composer.json to its original content.

I haven't noticed the phpspec upgrade card, I'll try to give it a look 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you try to delete your local composer.lock first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shame on me 🔨 removing the composer.lock file and running composer install again did the trick :) Thank you 👍

throw StorageFailure::unexpectedFailure('read', ['key' => $key], $e);
}

if (false === $result) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Flysystem adapters are less stricter than us? Funny :)

@akerouanton akerouanton merged commit 8133123 into 1.x Jul 11, 2017
@akerouanton akerouanton deleted the feature/flysystem-adapter-exceptions branch July 11, 2017 12:11
@akerouanton
Copy link
Contributor

Great job! Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants