Skip to content

Commit

Permalink
Remove deprecated prophecy calls and MimeTypeGuesserInterface. (#50)
Browse files Browse the repository at this point in the history
* Remove deprecated prophecy calls and MimeTypeGuesserInterface.

* Test on released 10.1.x.

* Additional instance of MimeTypeGuesser.
  • Loading branch information
rosiel authored Jul 18, 2023
1 parent 862d653 commit 0ba57c3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fail-fast: false
matrix:
php-versions: ["8.1"]
drupal-version: ["9.5.x", "10.0.x", "10.1.x-dev"]
drupal-version: ["9.5.x", "10.0.x", "10.1.x"]
allowed_failure: [false]
mysql: ["8.0"]

Expand Down
8 changes: 4 additions & 4 deletions src/File/FileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Drupal\file\Entity\File;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
use Symfony\Component\Mime\MimeTypesInterface;

/**
* Gets file information for the image to be viewed.
Expand All @@ -16,17 +16,17 @@ class FileInformation implements FileInformationInterface {
/**
* File MimeType Guesser to use extension to determine file type.
*
* @var \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface
* @var \Symfony\Component\Mime\MimeTypesInterface
*/
private $mimetypeGuesser;

/**
* FileInformation constructor.
*
* @param \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface $mimeTypeGuesser
* @param \Symfony\Component\Mime\MimeTypesInterface $mimeTypeGuesser
* File mimetype guesser interface.
*/
public function __construct(MimeTypeGuesserInterface $mimeTypeGuesser) {
public function __construct(MimeTypesInterface $mimeTypeGuesser) {
$this->mimetypeGuesser = $mimeTypeGuesser;
}

Expand Down
12 changes: 8 additions & 4 deletions tests/src/Kernel/ConfigTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
use Drupal\file\Entity\File;
use Drupal\KernelTests\KernelTestBase;
use Drupal\openseadragon\File\FileInformation;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Component\Mime\MimeTypesInterface;

/**
* Tests the Config class.
Expand All @@ -16,6 +17,9 @@
* @coversDefaultClass Drupal\openseadragon\File\FileInformation
*/
class ConfigTests extends KernelTestBase {

use ProphecyTrait;

/**
* {@inheritdoc}
*/
Expand All @@ -27,14 +31,14 @@ class ConfigTests extends KernelTestBase {
/**
* The mimetype guesser prophecy.
*
* @var Prophecy\Prophet
* @var \Prophecy\Prophecy\ObjectProphecy
*/
private $mimeProphet;

/**
* The file entity prophecy.
*
* @var Prophecy\Prophet
* @var \Prophecy\Prophecy\ObjectProphecy
*/
private $fileProphet;

Expand All @@ -44,7 +48,7 @@ class ConfigTests extends KernelTestBase {
public function setUp(): void {
parent::setUp();

$this->mimeProphet = $this->prophesize(MimeTypeGuesserInterface::class);
$this->mimeProphet = $this->prophesize(MimeTypesInterface::class);
$this->fileProphet = $this->prophesize(File::class);
}

Expand Down
3 changes: 3 additions & 0 deletions tests/src/Kernel/IIIFManifestParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\LoggerInterface;

/**
Expand All @@ -22,6 +23,8 @@
*/
class IIIFManifestParserTest extends KernelTestBase {

use ProphecyTrait;

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 0ba57c3

Please sign in to comment.