Skip to content

Commit

Permalink
fix phpstan usage of deprecated FileSystemInterface::EXISTS_REPLACE o…
Browse files Browse the repository at this point in the history
…n Drupal 10.3
  • Loading branch information
WengerK committed Apr 26, 2024
1 parent 1b0d4cd commit c4cd9c5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\Tests\entity_to_text_tika\Kernel;

use Drupal\Core\File\FileExists;
use Drupal\Core\File\FileSystemInterface;
use Drupal\entity_to_text_tika\Storage\LocalFileStorage;
use Drupal\file\Entity\File;
Expand Down Expand Up @@ -61,7 +62,11 @@ protected function setUp(): void {
public function testloadPublic(): void {
// Create an OCR file for testing.
$file_uri = $this->createUri('390-foo.txt.en.ocr.txt', 'Ipsum excepteur id cupidatat commodo', 'private');
$this->fileSystem->move($file_uri, 'private://entity-to-text/ocr/390-foo.txt.en.ocr.txt', FileSystemInterface::EXISTS_REPLACE);

// Since Drupal 10.3 FileSystemInterface replaced with an enum.
// @see https://www.drupal.org/node/3426517
$exists_replace = version_compare(\Drupal::VERSION, '10.3', '>=') ? FileSystemInterface::EXISTS_REPLACE : FileExists::Replace;
$this->fileSystem->move($file_uri, 'private://entity-to-text/ocr/390-foo.txt.en.ocr.txt', $exists_replace);

// Create a file that correspond to the previous OCR file.
$file = File::create([
Expand Down

0 comments on commit c4cd9c5

Please sign in to comment.