Skip to content

Commit

Permalink
Add support for Laravel 10
Browse files Browse the repository at this point in the history
fixed some PHPUnit deprecations
  • Loading branch information
frasmage committed Feb 17, 2023
1 parent f613f66 commit fee7bcc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
8 changes: 4 additions & 4 deletions composer.json
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/ImageManipulatorTest.php
Expand Up @@ -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(
Expand All @@ -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'
Expand All @@ -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) {
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/SourceAdapters/SourceAdapterFactoryTest.php
Expand Up @@ -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));
Expand All @@ -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'));
Expand Down
9 changes: 5 additions & 4 deletions tests/Integration/UrlGenerators/UrlGeneratorFactoryTest.php
Expand Up @@ -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');
}
Expand Down

0 comments on commit fee7bcc

Please sign in to comment.