Commit 85170c95 authored by webchick's avatar webchick

Issue #2108573 by pwolanin, swentel: Password-hash.sh is broken.

parent ae1a458d
<?php
/**
* @file
* Contains \Drupal\system\Tests\System\ScriptTest.
*/
namespace Drupal\system\Tests\System;
use Drupal\simpletest\UnitTestBase;
/**
* Tests core shell scripts.
*/
class ScriptTest extends UnitTestBase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Shell scripts',
'description' => 'Tests Core utility shell scripts.',
'group' => 'System',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$path_parts = explode(DIRECTORY_SEPARATOR, __DIR__);
// This file is 8 levels below the Drupal root.
$root = implode(DIRECTORY_SEPARATOR, array_slice($path_parts, 0, -8));
chdir($root);
}
/**
* Tests password-hash.sh.
*/
public function testPasswordHashSh() {
$cmd = 'core/scripts/password-hash.sh xyz';
exec($cmd, $output, $exit_code);
$this->assertIdentical(0, $exit_code, 'Exit code');
$this->assertTrue(strpos(implode(' ', $output), 'hash: $S$') !== FALSE);
}
/**
* Tests rebuild_token_calculator.sh.
*/
public function testRebuildTokenCalculatorSh() {
$cmd = 'core/scripts/rebuild_token_calculator.sh';
exec($cmd, $output, $exit_code);
$this->assertIdentical(0, $exit_code, 'Exit code');
$this->assertTrue(strpos(implode(' ', $output), 'token=') !== FALSE);
}
}
#!/usr/bin/php
#!/usr/bin/env php
<?php
/**
......@@ -78,10 +78,12 @@
}
}
chdir('..');
$core = dirname(__DIR__);
include_once $core . '/includes/password.inc';
include_once $core . '/includes/bootstrap.inc';
require_once $core . '/vendor/autoload.php';
require_once $core . '/includes/bootstrap.inc';
// Bootstrap the code so we have the container.
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
$password_hasher = \Drupal::service('password');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment