From 75dd0a40f1086d59ec44fd5dcb36de6f536d7273 Mon Sep 17 00:00:00 2001 From: Klaus Purer Date: Fri, 28 Jun 2024 13:49:06 +0300 Subject: [PATCH] test(drupal): Test Drupal 10.3 (#1410) --- .github/workflows/testing.yml | 8 ++++++-- src/Config/LanguageConfigOverride.php | 1 - src/GraphQL/Utility/FileUpload.php | 4 ++++ tests/src/Kernel/DataProducer/RoutingTest.php | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 063e6515f..419545349 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -14,16 +14,20 @@ jobs: fail-fast: false matrix: php-versions: ['8.1', '8.2'] - drupal-core: ['10.2.x'] + drupal-core: ['10.3.x'] phpstan: ['0'] include: # Extra run to test older supported Drupal 10.1.x. - php-versions: '8.1' drupal-core: '10.1.x' phpstan: '0' + # Extra run to test older supported Drupal 10.2.x. + - php-versions: '8.1' + drupal-core: '10.2.x' + phpstan: '0' # We only need to run PHPStan once on the latest PHP version. - php-versions: '8.3' - drupal-core: '10.2.x' + drupal-core: '10.3.x' phpstan: '1' steps: - name: Checkout Drupal core diff --git a/src/Config/LanguageConfigOverride.php b/src/Config/LanguageConfigOverride.php index 979b3bffb..f6c7c4171 100644 --- a/src/Config/LanguageConfigOverride.php +++ b/src/Config/LanguageConfigOverride.php @@ -75,7 +75,6 @@ public function getCacheSuffix() { public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) { // The interface says we should return an object here, but we don't care and // this does not seem to break anything? - // @phpstan-ignore-next-line return NULL; } diff --git a/src/GraphQL/Utility/FileUpload.php b/src/GraphQL/Utility/FileUpload.php index 7f8cbd124..7543ea5c7 100644 --- a/src/GraphQL/Utility/FileUpload.php +++ b/src/GraphQL/Utility/FileUpload.php @@ -248,6 +248,8 @@ public function saveFileUpload(UploadedFile $uploaded_file, array $settings): Fi $temp_file_path = $uploaded_file->getRealPath(); + // Drupal 10.2 compatibility: use the deprecated constant for now. + // @phpstan-ignore-next-line $file_uri = $this->fileSystem->getDestinationFilename($file_uri, FileSystemInterface::EXISTS_RENAME); // Lock based on the prepared file URI. @@ -291,6 +293,8 @@ public function saveFileUpload(UploadedFile $uploaded_file, array $settings): Fi // FileSystemInterface::EXISTS_ERROR as the file location has already been // determined above in FileSystem::getDestinationFilename(). try { + // Drupal 10.2 compatibility: use the deprecated constant for now. + // @phpstan-ignore-next-line $this->fileSystem->move($temp_file_path, $file_uri, FileSystemInterface::EXISTS_ERROR); } catch (FileException $e) { diff --git a/tests/src/Kernel/DataProducer/RoutingTest.php b/tests/src/Kernel/DataProducer/RoutingTest.php index 5c1f7461b..7c4e6ea66 100644 --- a/tests/src/Kernel/DataProducer/RoutingTest.php +++ b/tests/src/Kernel/DataProducer/RoutingTest.php @@ -35,6 +35,7 @@ class RoutingTest extends GraphQLTestBase { public function setUp(): void { parent::setUp(); + $this->installEntitySchema('path_alias'); $this->installEntitySchema('redirect'); $this->installConfig(['redirect']); @@ -129,7 +130,8 @@ public function testUrlPath(): void { 'url' => $url, ]); - $this->assertEquals('/user/logout', $result); + // Starting with Drupal 10.3 the URL has a token at the end, ignore that. + $this->assertStringStartsWith('/user/logout', $result); } /**