Skip to content

Commit 3dba0b9

Browse files
authored
Fix config level and fix DRUPAL_TEST_IN_CHILD_SITE constant
* Fix config level; prove some failures still exist * Actually fix DRUPAL_TEST_IN_CHILD_SITE * Conditionally define the constant
1 parent c65b9f5 commit 3dba0b9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/DependencyInjection/DrupalExtension.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,13 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
177177
// @todo find a non-hack way to pass the Drupal roots to the bootstrap file.
178178
$class->getMethod('initialize')->addBody('$GLOBALS["drupalRoot"] = ?;', [$this->drupalRoot]);
179179
$class->getMethod('initialize')->addBody('$GLOBALS["drupalVendorDir"] = ?;', [$this->drupalVendorDir]);
180+
181+
// DRUPAL_TEST_IN_CHILD_SITE is only defined in the \Drupal\Core\DrupalKernel::bootEnvironment method when
182+
// Drupal is bootstrapped. Since we don't actually invoke the bootstrapping of Drupal, define the constant here
183+
// as `false`. And we have to conditionally define it due to our own PHPUnit tests
184+
$class->getMethod('initialize')->addBody('
185+
if (!defined("DRUPAL_TEST_IN_CHILD_SITE")) {
186+
define("DRUPAL_TEST_IN_CHILD_SITE", ?);
187+
}', [false]);
180188
}
181189
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
parameters:
2+
reportUnmatchedIgnoredErrors: false
23
level: 7
4+
# Ignore functions for the PHPUnit bootstrap process.
5+
ignoreErrors:
6+
- '#Function drupal_phpunit_[a-zA-Z0-9\\_]+ not found#'
37
drupal:
48
drupal_root: %currentWorkingDirectory%
59
includes:
610
- ../../../extension.neon
11+
- ../../../vendor/phpstan/phpstan/conf/config.level2.neon
712
- ../../../vendor/phpstan/phpstan-deprecation-rules/rules.neon

0 commit comments

Comments
 (0)