diff options
Diffstat (limited to 'core/scripts')
-rw-r--r-- | core/scripts/css/compile.js | 1 | ||||
-rwxr-xr-x | core/scripts/dev/commit-code-check.sh | 15 | ||||
-rwxr-xr-x | core/scripts/run-tests.sh | 34 | ||||
-rwxr-xr-x | core/scripts/update-countries.sh | 12 |
4 files changed, 49 insertions, 13 deletions
diff --git a/core/scripts/css/compile.js b/core/scripts/css/compile.js index 9f5b71cb929d..a3794cd618ec 100644 --- a/core/scripts/css/compile.js +++ b/core/scripts/css/compile.js @@ -34,6 +34,7 @@ module.exports = (filePath, callback) => { 'image-set-function': false, 'prefers-color-scheme-query': false, 'content-alt-text': false, + 'nesting-rules': { edition: '2021' }, } }), postcssPixelsToRem({ diff --git a/core/scripts/dev/commit-code-check.sh b/core/scripts/dev/commit-code-check.sh index 541692236263..42d2ac670ad8 100755 --- a/core/scripts/dev/commit-code-check.sh +++ b/core/scripts/dev/commit-code-check.sh @@ -25,6 +25,7 @@ contains_element() { return 1 } +MEMORY_UNLIMITED=0 CACHED=0 DRUPALCI=0 BRANCH="" @@ -58,12 +59,22 @@ while test $# -gt 0; do DRUPALCI=1 shift ;; + --memory-unlimited) + MEMORY_UNLIMITED=1 + shift + ;; *) break ;; esac done +memory_limit="" + +if [[ "$MEMORY_UNLIMITED" == "1" ]]; then + memory_limit="--memory-limit=-1" +fi + # Set up variables to make colored output simple. Color output is disabled on # DrupalCI because it is breaks reporting. # @todo https://www.drupal.org/project/drupalci_testbot/issues/3181869 @@ -238,11 +249,11 @@ printf "\n" # APCu is disabled to ensure that the composer classmap is not corrupted. if [[ $PHPSTAN_DIST_FILE_CHANGED == "1" ]] || [[ "$DRUPALCI" == "1" ]]; then printf "\nRunning PHPStan on *all* files.\n" - php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --no-progress --configuration="$TOP_LEVEL/core/phpstan.neon.dist" + php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --no-progress --configuration="$TOP_LEVEL/core/phpstan.neon.dist" $memory_limit else # Only run PHPStan on changed files locally. printf "\nRunning PHPStan on changed files.\n" - php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --no-progress --configuration="$TOP_LEVEL/core/phpstan-partial.neon" $ABS_FILES + php -d apc.enabled=0 -d apc.enable_cli=0 vendor/bin/phpstan analyze --no-progress --configuration="$TOP_LEVEL/core/phpstan-partial.neon" $ABS_FILES $memory_limit fi if [ "$?" -ne "0" ]; then diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 96f16eed9c71..dd831ee38ad3 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -89,7 +89,7 @@ if ($args['list']) { // Display all available tests organized by one @group annotation. echo "\nAvailable test groups & classes\n"; echo "-------------------------------\n\n"; - $test_discovery = new PhpUnitTestDiscovery(\Drupal::root() . \DIRECTORY_SEPARATOR . 'core'); + $test_discovery = PhpUnitTestDiscovery::instance()->setConfigurationFilePath(\Drupal::root() . \DIRECTORY_SEPARATOR . 'core'); try { $groups = $test_discovery->getTestClasses($args['module']); foreach ($test_discovery->getWarnings() as $warning) { @@ -122,7 +122,7 @@ if ($args['list']) { // @see https://www.drupal.org/node/2569585 if ($args['list-files'] || $args['list-files-json']) { // List all files which could be run as tests. - $test_discovery = new PhpUnitTestDiscovery(\Drupal::root() . \DIRECTORY_SEPARATOR . 'core'); + $test_discovery = PhpUnitTestDiscovery::instance()->setConfigurationFilePath(\Drupal::root() . \DIRECTORY_SEPARATOR . 'core'); // PhpUnitTestDiscovery::findAllClassFiles() gives us a classmap similar to a // Composer 'classmap' array. $test_classes = $test_discovery->findAllClassFiles(); @@ -179,10 +179,18 @@ if (!Composer::upgradePHPUnitCheck(Version::id())) { echo "\n"; echo "Drupal test run\n\n"; -echo sprintf("Drupal Version: %s\n", \Drupal::VERSION); -echo sprintf("PHP Version: %s\n", \PHP_VERSION); -echo sprintf("PHP Binary: %s\n", $php ?? getenv('_')); -echo sprintf("PHPUnit Version: %s\n", Version::id()); +echo sprintf("Drupal Version: %s\n", \Drupal::VERSION); +echo sprintf("PHP Version: %s\n", \PHP_VERSION); +echo sprintf("PHP Binary: %s\n", $php ?? getenv('_')); +echo sprintf("PHPUnit Version: %s\n", Version::id()); +if ($args['dburl']) { + $sut_connection_info = Database::getConnectionInfo(); + $sut_tasks_class = $sut_connection_info['default']['namespace'] . "\\Install\\Tasks"; + $sut_installer = new $sut_tasks_class(); + $sut_connection = Database::getConnection(); + echo sprintf("Database: %s\n", (string) $sut_installer->name()); + echo sprintf("Database Version: %s\n", $sut_connection->version()); +} echo "-------------------------------\n"; echo "\n"; @@ -667,7 +675,7 @@ function simpletest_script_setup_database($new = FALSE): void { // Remove a possibly existing default connection (from settings.php). Database::removeConnection('default'); try { - $databases['default']['default'] = Database::convertDbUrlToConnectionInfo($args['dburl'], DRUPAL_ROOT, TRUE); + $databases['default']['default'] = Database::convertDbUrlToConnectionInfo($args['dburl'], TRUE); } catch (\InvalidArgumentException $e) { simpletest_script_print_error('Invalid --dburl. Reason: ' . $e->getMessage()); @@ -934,14 +942,20 @@ function simpletest_script_command(TestRun $test_run, string $test_class): array function simpletest_script_get_test_list() { global $args; - $test_discovery = new PhpUnitTestDiscovery(\Drupal::root() . \DIRECTORY_SEPARATOR . 'core'); + $test_discovery = PhpUnitTestDiscovery::instance()->setConfigurationFilePath(\Drupal::root() . \DIRECTORY_SEPARATOR . 'core'); $test_list = []; $slow_tests = []; if ($args['all'] || $args['module'] || $args['directory']) { try { $groups = $test_discovery->getTestClasses($args['module'], $args['types'], $args['directory']); - foreach ($test_discovery->getWarnings() as $warning) { - simpletest_script_print($warning . "\n", SIMPLETEST_SCRIPT_COLOR_EXCEPTION); + $warnings = $test_discovery->getWarnings(); + if (!empty($warnings)) { + simpletest_script_print("Test discovery warnings\n", SIMPLETEST_SCRIPT_COLOR_BRIGHT_WHITE); + simpletest_script_print("-----------------------\n", SIMPLETEST_SCRIPT_COLOR_BRIGHT_WHITE); + foreach ($warnings as $warning) { + simpletest_script_print('* ' . $warning . "\n\n", SIMPLETEST_SCRIPT_COLOR_EXCEPTION); + } + echo "\n"; } } catch (Exception $e) { diff --git a/core/scripts/update-countries.sh b/core/scripts/update-countries.sh index 52676e9f30bb..59f04b196ee6 100755 --- a/core/scripts/update-countries.sh +++ b/core/scripts/update-countries.sh @@ -35,6 +35,16 @@ USAGE; exit('CLDR data file not found. (' . $uri . ")\n\n" . $usage . "\n"); } +// Fake the t() function used in CountryManager.php instead of attempting a full +// Drupal bootstrap of core/includes/bootstrap.inc (where t() is declared). +if (!function_exists('t')) { + + function t($string): string { + return $string; + } + +} + // Read in existing codes. // @todo Allow to remove previously existing country codes. // @see https://www.drupal.org/node/1436754 @@ -93,7 +103,7 @@ $out = ''; foreach ($countries as $code => $name) { // For .po translation file's sake, use double-quotes instead of escaped // single-quotes. - $name = str_contains($name, '\'' ? '"' . $name . '"' : "'" . $name . "'"); + $name = str_contains($name, '\'') ? '"' . $name . '"' : "'" . $name . "'"; $out .= ' ' . var_export($code, TRUE) . ' => t(' . $name . '),' . "\n"; } |