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

Resolves issue #34 #35

Merged
merged 1 commit into from Dec 7, 2020
Merged

Resolves issue #34 #35

merged 1 commit into from Dec 7, 2020

Conversation

peter279k
Copy link
Contributor

Closes #34.

Copy link
Owner

@j0k3r j0k3r left a comment

Choose a reason for hiding this comment

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

Could you fix tests?

@@ -49,7 +49,7 @@ public function upload($data)
}

if ('file' === $data['type']) {
$data['image'] = '@' . $data['image'];
Copy link
Owner

Choose a reason for hiding this comment

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

The @ tricks is working with curl https://www.iditect.com/how-to/56655862.html
But I don't know with Guzzle.

@peter279k
Copy link
Contributor Author

The failed test is as follows:

1) Imgur\tests\Api\ImageTest::testUploadWithFile
fopen(./ZOY11VC.png): failed to open stream: No such file or directory
/home/travis/build/peter279k/php-imgur-api-client/lib/Imgur/Api/Image.php:52
/home/travis/build/peter279k/php-imgur-api-client/tests/Api/ImageTest.php:144

Download the http://i.imgur.com/ZOY11VC.png to the local image file on tests/Api/ZOY11VC.png folder and let this file be under Git version control.

@@ -33,7 +33,7 @@ before_script:
- composer install --prefer-dist --no-interaction -o

script:
- ./vendor/bin/simple-phpunit -v --coverage-clover=coverage.clover
- XDEBUG_MODE=coverage ./vendor/bin/simple-phpunit -v --coverage-clover=coverage.clover
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fix is issued by following error:

PHP Fatal error:  Uncaught SebastianBergmann\CodeCoverage\RuntimeException: XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set in /home/travis/build/peter279k/php-imgur-api-client/vendor/bin/.phpunit/phpunit-8.3-0/vendor/phpunit/php-code-coverage/src/Driver/Xdebug.php:50
Stack trace:
....

And the reference is available here.

@peter279k
Copy link
Contributor Author

Fix coding style via PHP-CS-Fixer during PHP-7.2 coding style checking:

4.16s$ if [ "$CS_FIXER" = "run" ]; then php vendor/bin/php-cs-fixer fix --verbose --dry-run ; fi;
Loaded config default from "/home/travis/build/peter279k/php-imgur-api-client/.php_cs".
Runtime: PHP 7.2.15
F..F.F..........FF.......F.F..F.FFFFFFF.F.F...
Legend: ?-unknown, I-invalid file syntax (file ignored), S-skipped (cached or empty file), .-no changes, F-fixed, E-error
   1) lib/Imgur/Auth/OAuth2.php (no_superfluous_phpdoc_tags, phpdoc_align)
   2) lib/Imgur/Api/Album.php (no_superfluous_phpdoc_tags)
   3) lib/Imgur/Api/CustomGallery.php (no_superfluous_phpdoc_tags, phpdoc_trim_consecutive_blank_line_separation)
   4) lib/Imgur/Middleware/ErrorMiddleware.php (no_superfluous_phpdoc_tags, phpdoc_trim)
   5) lib/Imgur/Middleware/AuthMiddleware.php (no_superfluous_phpdoc_tags, phpdoc_trim)
   6) lib/Imgur/HttpClient/HttpClient.php (no_superfluous_phpdoc_tags)
   7) lib/Imgur/Client.php (no_superfluous_phpdoc_tags, no_empty_phpdoc, no_whitespace_in_blank_line, no_extra_blank_lines)
   8) tests/Api/GalleryTest.php (php_unit_mock_short_will_return)
   9) tests/Api/AlbumTest.php (php_unit_mock_short_will_return)
  10) tests/Api/NotificationTest.php (php_unit_mock_short_will_return)
  11) tests/Api/CustomGalleryTest.php (php_unit_mock_short_will_return)
  12) tests/Api/AccountTest.php (php_unit_mock_short_will_return)
  13) tests/Api/CommentTest.php (php_unit_mock_short_will_return)
  14) tests/Api/ConversationTest.php (php_unit_mock_short_will_return)
  15) tests/Api/ImageTest.php (php_unit_mock_short_will_return)
  16) tests/Api/TopicTest.php (php_unit_mock_short_will_return)
  17) tests/Api/MemegenTest.php (php_unit_mock_short_will_return)

@peter279k peter279k requested a review from j0k3r December 5, 2020 15:17
@j0k3r
Copy link
Owner

j0k3r commented Dec 7, 2020

Good job!

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.

Image uploading API with file should be multipart/form-data header
2 participants