Skip to content

Commit

Permalink
test(core): Update Drupal core to 9.3 for testing (drupal-graphql#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
klausi committed Sep 21, 2023
1 parent 6c55b08 commit 6383c15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']
drupal-core: ['9.2.x']
drupal-core: ['9.3.x']
include:
# Extra run to also test on latest Drupal 8 and PHP 7.2.
- php-versions: '7.2'
Expand Down
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ parameters:
- """
#^Call to deprecated function file_munge_filename\\(\\)#
"""
- """
#^Call to deprecated function drupal_get_path\\(\\)#
"""
- """
#^Call to deprecated function file_create_url\\(\\)#
"""
- "#^Call to an undefined method Drupal\\\\Tests\\\\graphql\\\\Kernel\\\\DataProducer\\\\EntityTest\\:\\:assertMatchesRegularExpression\\(\\)\\.$#"
# Drupal allows object property access to custom fields, so we cannot fix
# that.
- "#^Property Drupal\\\\.+ \\(Drupal\\\\Core\\\\Field\\\\FieldItemListInterface\\) does not accept .+\\.$#"
Expand Down
9 changes: 8 additions & 1 deletion tests/src/Kernel/DataProducer/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,14 @@ public function testResolveEntityRendered(): void {

// @todo Add metadata check.
// $this->assertContains('node:1', $metadata->getCacheTags());
$this->assertStringContainsString('<a href="/node/1" rel="bookmark"><span>' . $this->node->getTitle() . '</span>', $result);
// Rendered output is slightly different in Drupal 8 vs. 9.
[$version] = explode('.', \Drupal::VERSION, 2);
if ($version == 8) {
$this->assertStringContainsString('<a href="/node/1" rel="bookmark"><span>' . $this->node->getTitle() . '</span>', $result);
}
else {
$this->assertMatchesRegularExpression('#<a href="/node/1" rel="bookmark">\s*<span>' . $this->node->getTitle() . '</span>#', $result);
}
}

}

0 comments on commit 6383c15

Please sign in to comment.