From 104fc7fd0dbf9020273d3990b62c84dd0aefedfa Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Fri, 11 May 2018 14:32:32 +0000 Subject: [PATCH] MDL-62408 behat: Correct PHPUNIT_TEST checks in behat_config_util --- lib/behat/classes/behat_config_util.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/behat/classes/behat_config_util.php b/lib/behat/classes/behat_config_util.php index 1546d0b179a..e393580c9e6 100644 --- a/lib/behat/classes/behat_config_util.php +++ b/lib/behat/classes/behat_config_util.php @@ -672,7 +672,7 @@ class behat_config_util { public function profile_guided_allocate($features, $nbuckets, $instance) { // No profile guided allocation is required in phpunit. - if (defined('PHPUNIT_TEST')) { + if (defined('PHPUNIT_TEST') && PHPUNIT_TEST) { return false; } @@ -725,7 +725,8 @@ class behat_config_util { $totalweight += $weight; } - if ($totalweight && !defined('BEHAT_DISABLE_HISTOGRAM') && $instance == $nbuckets && !defined('PHPUNIT_TEST')) { + if ($totalweight && !defined('BEHAT_DISABLE_HISTOGRAM') && $instance == $nbuckets + && (!defined('PHPUNIT_TEST') || !PHPUNIT_TEST)) { echo "Bucket weightings:\n"; foreach ($weights as $k => $weight) { echo $k + 1 . ": " . str_repeat('*', 70 * $nbuckets * $weight / $totalweight) . PHP_EOL; @@ -960,7 +961,7 @@ class behat_config_util { unset($features[$key]); } else { $featurestocheck = $this->get_components_features(); - if (!isset($featurestocheck[$key]) && !defined('PHPUNIT_TEST')) { + if (!isset($featurestocheck[$key]) && (!defined('PHPUNIT_TEST') || !PHPUNIT_TEST)) { behat_error(BEHAT_EXITCODE_REQUIREMENT, 'Blacklisted feature "' . $blacklistpath . '" not found.'); } }