Skip to content

Commit b5c980d

Browse files
authored
Fix tests after drupal/core changes (#605)
* Fix tests after drupal/core changes * fix conditionals on dev branch * ordering matters
1 parent a19934c commit b5c980d

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
- name: "require phpstan-drupal"
128128
run: |
129129
cd ~/drupal
130-
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/phpstan-drupal "${{ steps.branch_alias.outputs.VERSION_ALIAS }} as 1.1.99" phpstan/extension-installer --with-all-dependencies
130+
COMPOSER_MEMORY_LIMIT=-1 composer require mglaman/phpstan-drupal "${{ steps.branch_alias.outputs.VERSION_ALIAS }} as 1.2.99" phpstan/extension-installer --with-all-dependencies
131131
cp $GITHUB_WORKSPACE/tests/fixtures/config/drupal-phpstan.neon phpstan.neon
132132
- name: "Test core/install.php"
133133
run: |

tests/src/Rules/RevisionableStorageInterfaceStubTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,22 @@ protected function getRule(): Rule
2424
public function testRule(): void
2525
{
2626
$errors = [];
27-
if (version_compare(\Drupal::VERSION, '10.1', '>=')) {
27+
$drupalVersion = str_replace('-dev', '', \Drupal::VERSION);
28+
if (version_compare($drupalVersion, '10.1', '>=')) {
29+
// There's a quirk on 10.1.x+ which false reports this error but was fixed on 11.x.
30+
if (version_compare($drupalVersion, '11.0', '<')) {
31+
$errors[] = [
32+
'Call to deprecated method loadRevision() of class Drupal\Core\Entity\EntityStorageInterface:
33+
in drupal:10.1.0 and is removed from drupal:11.0.0. Use
34+
\Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead.',
35+
12
36+
];
37+
}
2838
$errors[] = [
2939
'Call to deprecated method loadRevision() of class Drupal\Core\Entity\EntityStorageInterface:
3040
in drupal:10.1.0 and is removed from drupal:11.0.0. Use
3141
\Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead.',
32-
12
42+
15
3343
];
3444
}
3545
$this->analyse(

tests/src/Rules/data/bug-586.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
$genericContentEntityStorage = \Drupal::entityTypeManager()->getStorage('foo');
1111
assert($genericContentEntityStorage instanceof ContentEntityStorageInterface);
1212
$genericContentEntityStorage->loadRevision(1);
13+
14+
$genericEntityStorage = \Drupal::entityTypeManager()->getStorage('bar');
15+
$genericEntityStorage->loadRevision(1);

0 commit comments

Comments
 (0)