diff --git a/core/modules/system/src/Tests/System/ScriptTest.php b/core/modules/system/src/Tests/System/ScriptTest.php deleted file mode 100644 index 6f6d871694d9e0efa56e201ec96e9e042a653c70..0000000000000000000000000000000000000000 --- a/core/modules/system/src/Tests/System/ScriptTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\system\Tests\System\ScriptTest. - */ - -namespace Drupal\system\Tests\System; - -use Drupal\simpletest\DrupalUnitTestBase; - -/** - * Tests core shell scripts. - * - * @group system - */ -class ScriptTest extends DrupalUnitTestBase { - - protected function setUp() { - parent::setUp(); - require_once DRUPAL_ROOT . '/core/includes/install.inc'; - } - - /** - * Tests password-hash.sh. - */ - public function testPasswordHashSh() { - // The script requires a settings.php with a hash salt setting. - $filename = $this->siteDirectory . '/settings.php'; - touch($filename); - $settings['settings']['hash_salt'] = (object) array( - 'value' => 'some_random_key', - 'required' => TRUE, - ); - drupal_rewrite_settings($settings, $filename); - $_SERVER['argv'] = array( - 'core/scripts/password-hash.sh', - 'xyz', - ); - ob_start(); - include DRUPAL_ROOT . '/core/scripts/password-hash.sh'; - $this->setRawContent(ob_get_contents()); - ob_end_clean(); - $this->assertRaw('hash: $S$'); - } - - /** - * Tests rebuild_token_calculator.sh. - */ - public function testRebuildTokenCalculatorSh() { - // The script requires a settings.php with a hash salt setting. - $filename = $this->siteDirectory . '/settings.php'; - touch($filename); - $settings['settings']['hash_salt'] = (object) array( - 'value' => 'some_random_key', - 'required' => TRUE, - ); - drupal_rewrite_settings($settings, $filename); - $_SERVER['argv'] = array( - 'core/scripts/rebuild_token_calculator.sh', - ); - ob_start(); - include DRUPAL_ROOT . '/core/scripts/rebuild_token_calculator.sh'; - $this->setRawContent(ob_get_contents()); - ob_end_clean(); - $this->assertRaw('token='); - } - -} diff --git a/core/scripts/password-hash.sh b/core/scripts/password-hash.sh index ee3c10246dc295e8fc34c1547346bda62c4e88f6..9e66a16fdddf2a2f1ed8e8b70202e1afb9ee7bf3 100755 --- a/core/scripts/password-hash.sh +++ b/core/scripts/password-hash.sh @@ -11,10 +11,7 @@ use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; -// Check for $_SERVER['argv'] instead of PHP_SAPI === 'cli' to allow this script -// to be tested with the Simpletest UI test runner. -// @see \Drupal\system\Tests\System\ScriptTest -if (!isset($_SERVER['argv']) || !is_array($_SERVER['argv'])) { +if (PHP_SAPI !== 'cli') { return; } diff --git a/core/scripts/rebuild_token_calculator.sh b/core/scripts/rebuild_token_calculator.sh index bcfd2b6fc16add9b80089f219e18d0957aaebcb0..87c306995e6cc40837f12940f6234909083b293b 100755 --- a/core/scripts/rebuild_token_calculator.sh +++ b/core/scripts/rebuild_token_calculator.sh @@ -11,10 +11,7 @@ use Drupal\Core\Site\Settings; use Symfony\Component\HttpFoundation\Request; -// Check for $_SERVER['argv'] instead of PHP_SAPI === 'cli' to allow this script -// to be tested with the Simpletest UI test runner. -// @see \Drupal\system\Tests\System\ScriptTest -if (!isset($_SERVER['argv']) || !is_array($_SERVER['argv'])) { +if (PHP_SAPI !== 'cli') { return; }