From fee7bccc0c9af54a6e0f57af80c195d154db6928 Mon Sep 17 00:00:00 2001 From: Sean Fraser Date: Thu, 16 Feb 2023 20:39:14 -0500 Subject: [PATCH] Add support for Laravel 10 fixed some PHPUnit deprecations --- composer.json | 8 ++++---- tests/Integration/ImageManipulatorTest.php | 6 +++--- .../SourceAdapters/SourceAdapterFactoryTest.php | 4 ++-- .../UrlGenerators/UrlGeneratorFactoryTest.php | 9 +++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 3ffafaeb..860450ee 100644 --- a/composer.json +++ b/composer.json @@ -12,9 +12,9 @@ "require": { "php": ">=7.4.0", "ext-fileinfo": "*", - "illuminate/support": "^8.83.3|^9.0", - "illuminate/filesystem": "^8.83.3|^9.0", - "illuminate/database": "^8.83.3|^9.0", + "illuminate/support": "^8.83.3|^9.0|^10.0", + "illuminate/filesystem": "^8.83.3|^9.0|^10.0", + "illuminate/database": "^8.83.3|^9.0|^10.0", "league/flysystem": "^1.1.9|^2.4.2|^3.0.4", "psr/http-message": "^1.0.1", "intervention/image": "^2.7.1", @@ -23,7 +23,7 @@ }, "require-dev": { - "orchestra/testbench": "^6.6|^7.0", + "orchestra/testbench": "^6.6|^7.0|^8.0", "phpunit/phpunit": "^9.5.13", "mockery/mockery": "^1.4.2", "vlucas/phpdotenv": "^4.2.2|^5.4.1", diff --git a/tests/Integration/ImageManipulatorTest.php b/tests/Integration/ImageManipulatorTest.php index 03697cf1..c44745a7 100644 --- a/tests/Integration/ImageManipulatorTest.php +++ b/tests/Integration/ImageManipulatorTest.php @@ -95,7 +95,7 @@ public function test_it_can_store_and_retrieve_by_tag() public function test_it_throws_for_non_image_media() { $this->expectException(ImageManipulationException::class); - $this->expectErrorMessage( + $this->expectExceptionMessage( "Cannot manipulate media with an aggregate type other than 'image', got 'document'." ); $this->getManipulator()->createImageVariant( @@ -107,7 +107,7 @@ public function test_it_throws_for_non_image_media() public function test_it_throws_for_unknown_variants() { $this->expectException(ImageManipulationException::class); - $this->expectErrorMessage("Unknown variant 'invalid'."); + $this->expectExceptionMessage("Unknown variant 'invalid'."); $this->getManipulator()->createImageVariant( $this->makeMedia(['aggregate_type' => 'image']), 'invalid' @@ -118,7 +118,7 @@ public function test_it_throws_for_indeterminate_output_format() { $this->useFilesystem('tmp'); $this->expectException(ImageManipulationException::class); - $this->expectErrorMessage("Unable to determine valid output format for file."); + $this->expectExceptionMessage("Unable to determine valid output format for file."); $manipulation = ImageManipulation::make( function (Image $image) { } diff --git a/tests/Integration/SourceAdapters/SourceAdapterFactoryTest.php b/tests/Integration/SourceAdapters/SourceAdapterFactoryTest.php index 8dcf00f3..722f8f09 100644 --- a/tests/Integration/SourceAdapters/SourceAdapterFactoryTest.php +++ b/tests/Integration/SourceAdapters/SourceAdapterFactoryTest.php @@ -15,7 +15,7 @@ public function test_it_allows_setting_adapter_for_class() $factory = new SourceAdapterFactory; $source = $this->createMock(stdClass::class); $sourceClass = get_class($source); - $adapterClass = $this->getMockClass(SourceAdapterInterface::class); + $adapterClass = get_class($this->createMock(SourceAdapterInterface::class)); $factory->setAdapterForClass($adapterClass, $sourceClass); $this->assertInstanceOf($adapterClass, $factory->create($source)); @@ -24,7 +24,7 @@ public function test_it_allows_setting_adapter_for_class() public function test_it_allows_setting_adapter_for_pattern() { $factory = new SourceAdapterFactory; - $adapterClass = $this->getMockClass(SourceAdapterInterface::class); + $adapterClass = get_class($this->createMock(SourceAdapterInterface::class)); $factory->setAdapterForPattern($adapterClass, '[abc][123]'); $this->assertInstanceOf($adapterClass, $factory->create('b1')); diff --git a/tests/Integration/UrlGenerators/UrlGeneratorFactoryTest.php b/tests/Integration/UrlGenerators/UrlGeneratorFactoryTest.php index d81dca53..db35f6b1 100644 --- a/tests/Integration/UrlGenerators/UrlGeneratorFactoryTest.php +++ b/tests/Integration/UrlGenerators/UrlGeneratorFactoryTest.php @@ -16,19 +16,20 @@ class UrlGeneratorFactoryTest extends TestCase public function test_it_sets_generator_for_driver() { $factory = new UrlGeneratorFactory; - $generator = $this->getMockClass(UrlGeneratorInterface::class); + $generator = $this->createMock(UrlGeneratorInterface::class); + $class = get_class($generator); $media = factory(Media::class)->make(['disk' => 'uploads']); - $factory->setGeneratorForFilesystemDriver($generator, 'local'); + $factory->setGeneratorForFilesystemDriver($class, 'local'); $result = $factory->create($media); - $this->assertInstanceOf($generator, $result); + $this->assertInstanceOf($class, $result); } public function test_it_throws_exception_for_invalid_generator() { $factory = new UrlGeneratorFactory; - $class = $this->getMockClass(stdClass::class); + $class = get_class($this->createMock(stdClass::class)); $this->expectException(MediaUrlException::class); $factory->setGeneratorForFilesystemDriver($class, 'foo'); }