diff --git a/.phpunit.result.cache b/.phpunit.result.cache deleted file mode 100644 index 9015d01..0000000 --- a/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -C:37:"PHPUnit\Runner\DefaultTestResultCache":5364:{a:2:{s:7:"defects";a:1:{s:94:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::regression__it_handles_none_existent_images";i:3;}s:5:"times";a:50:{s:72:"Makeable\CloudImages\Tests\Feature\CleanupTest::it_deletes_unused_images";d:1.032;s:72:"Makeable\CloudImages\Tests\Feature\CleanupTest::it_preserves_used_images";d:0.101;s:64:"Makeable\CloudImages\Tests\Feature\DeleteTest::it_deletes_images";d:0.056;s:92:"Makeable\CloudImages\Tests\Feature\DeleteTest::it_throws_exception_on_failed_bucket_deletion";d:0.18;s:89:"Makeable\CloudImages\Tests\Feature\DeleteTest::it_throws_exception_on_failed_http_request";d:0.038;s:78:"Makeable\CloudImages\Tests\Feature\DeleteTest::it_dispatches_event_on_deletion";d:0.115;s:109:"Makeable\CloudImages\Tests\Feature\FileSizeOptimizedDimensionCalculatorTest::it_returns_collection_with_sizes";d:0.06;s:126:"Makeable\CloudImages\Tests\Feature\FileSizeOptimizedDimensionCalculatorTest::it_generates_sizes_until_last_image_is_very_small";d:0.061;s:106:"Makeable\CloudImages\Tests\Feature\GeneratePlaceholdersTest::it_generates_placeholders_and_sets_dimensions";d:0.903;s:85:"Makeable\CloudImages\Tests\Feature\HasMultipleImagesTest::it_attaches_to_other_models";d:0.104;s:87:"Makeable\CloudImages\Tests\Feature\HasMultipleImagesTest::it_sorts_attachments_by_order";d:0.242;s:84:"Makeable\CloudImages\Tests\Feature\HasMultipleImagesTest::it_can_rearrange_the_order";d:0.209;s:96:"Makeable\CloudImages\Tests\Feature\HasMultipleImagesTest::it_finds_attachables_for_a_given_model";d:0.125;s:121:"Makeable\CloudImages\Tests\Feature\HasMultipleImagesTest::it_uses_the_specified_image_class_property_for_the_relationship";d:0.149;s:90:"Makeable\CloudImages\Tests\Feature\HasSingleImageTest::it_has_a_getter_for_as_single_image";d:0.158;s:81:"Makeable\CloudImages\Tests\Feature\HasSingleImageTest::it_defaults_to_empty_image";d:0.157;s:85:"Makeable\CloudImages\Tests\Feature\HasSingleImageTest::it_replaces_with_another_image";d:0.119;s:104:"Makeable\CloudImages\Tests\Feature\HasSingleImageTest::it_replaces_with_image_even_if_currently_has_none";d:0.164;s:91:"Makeable\CloudImages\Tests\Feature\HasSingleImageTest::it_can_fetch_an_image_of_a_given_tag";d:0.121;s:76:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_defaults_to_original";d:0.068;s:64:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_can_blur";d:0.061;s:82:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_can_scale_to_max_dimension";d:0.046;s:79:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_can_scale_to_dimensions";d:0.078;s:78:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_can_crop_to_dimensions";d:0.042;s:76:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_can_crop_from_center";d:0.035;s:81:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_accepts_custom_parameters";d:0.074;s:85:"Makeable\CloudImages\Tests\Feature\ImageFactoryTest::it_returns_null_when_url_is_null";d:0.035;s:84:"Makeable\CloudImages\Tests\Feature\ImageTest::it_inserts_uploaded_images_to_database";d:0.083;s:86:"Makeable\CloudImages\Tests\Feature\ImageTest::it_deletes_cloud_image_on_model_deletion";d:0.131;s:68:"Makeable\CloudImages\Tests\Feature\ImageTest::it_can_store_exif_data";d:0.372;s:77:"Makeable\CloudImages\Tests\Feature\ImageTest::it_generates_a_tiny_placeholder";d:0.307;s:83:"Makeable\CloudImages\Tests\Feature\ImageTest::it_casts_to_a_responsive_html_img_tag";d:0.132;s:113:"Makeable\CloudImages\Tests\Feature\ImageTest::it_casts_to_a_responsive_html_img_tag_with_placeholder_when_enabled";d:0.174;s:77:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::it_needs_an_image_instance";d:0.075;s:93:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::it_returns_a_collection_of_image_factories";d:0.178;s:111:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::the_number_of_versions_depends_on_the_transformed_dimensions";d:0.109;s:93:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::it_applies_transformations_across_versions";d:0.149;s:103:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::the_smallest_version_is_a_tiny_placeholder_when_used";d:0.187;s:117:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::the_placeholder_stretches_to_the_dimensions_of_the_generated_image";d:0.148;s:113:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::responsive_factory_casts_to_an_array_suitable_for_api_response";d:0.165;s:109:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::responsive_factory_casts_to_json_suitable_for_api_response";d:0.103;s:89:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::regression__it_always_returns_integers";d:0.158;s:105:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::regression__it_also_scales_original_sizes_responsively";d:0.165;s:94:"Makeable\CloudImages\Tests\Feature\ResponsiveTest::regression__it_handles_none_existent_images";d:0.131;s:64:"Makeable\CloudImages\Tests\Feature\UploadTest::it_uploads_images";d:0.049;s:76:"Makeable\CloudImages\Tests\Feature\UploadTest::it_hashes_filename_on_default";d:0.113;s:69:"Makeable\CloudImages\Tests\Feature\UploadTest::it_accepts_a_file_path";d:0.027;s:83:"Makeable\CloudImages\Tests\Feature\UploadTest::it_throws_exception_on_failed_upload";d:0.044;s:76:"Makeable\CloudImages\Tests\Feature\UploadTest::it_dispatches_event_on_upload";d:0.106;s:67:"Makeable\CloudImages\Tests\Feature\UploadTest::it_can_be_set_public";d:0.065;}}} \ No newline at end of file diff --git a/composer.json b/composer.json index 48899bd..52ad628 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "illuminate/container": "^8.80|9.*", "illuminate/filesystem": "^8.80|9.*", "illuminate/support": "^8.80|9.*", - "superbalist/laravel-google-cloud-storage": "^2.2", + "spatie/laravel-google-cloud-storage": "^1.0|^2.0", "guzzlehttp/guzzle": "^7.0" }, "require-dev": { @@ -20,11 +20,10 @@ "intervention/image": "^2.4", "doctrine/dbal": "^3.0", "mockery/mockery": "^1.5", - "rutorika/sortable": "8.*", + "rutorika/sortable": "^8.0|^9.0", "phpunit/phpunit": "9.*" }, "suggest": { - "illuminate/database": "Required for using extended media library functionality", "intervention/image": "Intervention image is required to read exif data", "rutorika/sortable": "Required for using extended media library functionality" }, diff --git a/readme.md b/readme.md index 4957389..df20d3e 100644 --- a/readme.md +++ b/readme.md @@ -29,12 +29,12 @@ Add a new `gcs` disk to your `filesystems.php` config 'gcs' => [ 'driver' => 'gcs', 'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'), - 'key_file' => env('GOOGLE_CLOUD_KEY_FILE', '/path/to/service-account.json'), + 'key_file_path' => env('GOOGLE_CLOUD_KEY_FILE', '/path/to/service-account.json'), 'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'), ], ``` -See [https://github.com/Superbalist/laravel-google-cloud-storage](https://github.com/Superbalist/laravel-google-cloud-storage) for more details about configuring `filesystems.php`. +See [https://github.com/spatie/laravel-google-cloud-storage](https://github.com/spatie/laravel-google-cloud-storage) for more details about configuring `filesystems.php`. #### Creating a Google Service Account @@ -56,6 +56,14 @@ php artisan migrate php artisan cloud-images:placeholders ``` +### Upgrading from 2.x --> 3.x + +Starting with version 3 this package uses `spatie/laravel-google-cloud-storage` instead of `superbalist/laravel-google-cloud-storage`. + +- Please ensure you refer to the configuration options in [laravel-google-cloud-storage#installation](https://github.com/spatie/laravel-google-cloud-storage#installation). +- Specifically make sure you change your disk configuration in `config/filesystems.php` @ `gcs.key_file` --> `gcs.key_file_path`. + + ## Basic usage ### Upload an image diff --git a/src/CloudImagesServiceProvider.php b/src/CloudImagesServiceProvider.php index 754da7e..642f5fe 100644 --- a/src/CloudImagesServiceProvider.php +++ b/src/CloudImagesServiceProvider.php @@ -7,7 +7,7 @@ use Makeable\CloudImages\Console\Commands\Cleanup; use Makeable\CloudImages\Console\Commands\GeneratePlaceholders; use Makeable\CloudImages\Contracts\DimensionCalculator; -use Superbalist\LaravelGoogleCloudStorage\GoogleCloudStorageServiceProvider; +use Spatie\GoogleCloudStorage\GoogleCloudStorageServiceProvider; class CloudImagesServiceProvider extends ServiceProvider { diff --git a/tests/Feature/DeleteTest.php b/tests/Feature/DeleteTest.php index eefed70..8a5c072 100644 --- a/tests/Feature/DeleteTest.php +++ b/tests/Feature/DeleteTest.php @@ -26,16 +26,6 @@ public function it_deletes_images() $this->assertEquals('test.jpg', $deleted->path); } - /** @test **/ - public function it_throws_exception_on_failed_bucket_deletion() - { - $this->expectException(FailedDeletionException::class); - - // test.jpg does not exist in storage - - CloudImageFacade::delete('test.jpg'); - } - /** @test **/ public function it_throws_exception_on_failed_http_request() {