Skip to content

Commit

Permalink
Backport #2724 / f476dd5 (Sans Symfony 3) to Drush 8.x. (#2795)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson authored Jun 5, 2017
2 parents 3d812fa + fd3ab22 commit f4d0c07
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 8 deletions.
21 changes: 20 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,20 @@ env:
- UNISH_DRUPAL_MAJOR_VERSION=7 PHPUNIT_ARGS=--group=pm
- UNISH_DRUPAL_MAJOR_VERSION=7 PHPUNIT_ARGS=--group=quick-drupal
- UNISH_DRUPAL_MAJOR_VERSION=7 PHPUNIT_ARGS=--exclude-group=base,make,commands,pm,quick-drupal
#D8
#D8.3.x
- UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--group=make
- UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--group=base
- UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--group=commands
- UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--group=pm
- UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--group=quick-drupal
- UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--exclude-group=base,make,commands,pm,quick-drupal TEST_CHILDREN="drush-ops/config-extra"
#D8.4.x
- UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=make
- UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=base
- UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=commands
- UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=pm
- UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=quick-drupal
- UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--exclude-group=base,make,commands,pm,quick-drupal

# - UNISH_DB_URL=sqlite://none/of/this/matters PHPUNIT_ARGS=--group=make
# - UNISH_DB_URL=sqlite://none/of/this/matters PHPUNIT_ARGS=--group=base
Expand Down Expand Up @@ -86,6 +93,18 @@ matrix:
env: UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--group=quick-drupal
- php: 5.4
env: UNISH_DRUPAL_MAJOR_VERSION=8 PHPUNIT_ARGS=--exclude-group=base,make,commands,pm,quick-drupal TEST_CHILDREN="drush-ops/config-extra"
- php: 5.4
env: UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=make
- php: 5.4
env: UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=base
- php: 5.4
env: UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=commands
- php: 5.4
env: UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=pm
- php: 5.4
env: UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--group=quick-drupal
- php: 5.4
env: UNISH_DRUPAL_MAJOR_VERSION=8 UNISH_DRUPAL_MINOR_VERSION=4.x PHPUNIT_ARGS=--exclude-group=base,make,commands,pm,quick-drupal

before_install:
- echo 'mbstring.http_input = pass' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
Expand Down
9 changes: 5 additions & 4 deletions lib/Drush/Command/DrushInputAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
* 2) We do not want Symfony to attempt to validate our options or arguments
* for us.
*/
class DrushInputAdapter implements InputInterface {
class DrushInputAdapter implements InputInterface
{
protected $arguments;
protected $options;
protected $interactive;
Expand Down Expand Up @@ -52,13 +53,13 @@ public function __construct($arguments, $options, $command = false, $interactive
*/
public function getFirstArgument()
{
return reset($arguments);
return reset($this->arguments);
}

/**
* {@inheritdoc}
*/
public function hasParameterOption($values)
public function hasParameterOption($values, $onlyParams = false)
{
$values = (array) $values;

Expand All @@ -74,7 +75,7 @@ public function hasParameterOption($values)
/**
* {@inheritdoc}
*/
public function getParameterOption($values, $default = false)
public function getParameterOption($values, $default = false, $onlyParams = false)
{
$values = (array) $values;

Expand Down
14 changes: 12 additions & 2 deletions tests/Unish/UnishTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,14 @@ function db_driver($db_url = UNISH_DB_URL) {
return parse_url(UNISH_DB_URL, PHP_URL_SCHEME);
}

function setUpDrupal($num_sites = 1, $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL) {
function defaultInstallationVerion() {
return UNISH_DRUPAL_MAJOR_VERSION . UNISH_DRUPAL_MINOR_VERSION;
}

function setUpDrupal($num_sites = 1, $install = FALSE, $version_string = NULL, $profile = NULL) {
if (!$version_string) {
$version_string = UNISH_DRUPAL_MAJOR_VERSION;
}
$sites_subdirs_all = array('dev', 'stage', 'prod', 'retired', 'elderly', 'dead', 'dust');
$sites_subdirs = array_slice($sites_subdirs_all, 0, $num_sites);
$root = $this->webroot();
Expand Down Expand Up @@ -315,7 +322,10 @@ function setUpDrupal($num_sites = 1, $install = FALSE, $version_string = UNISH_D
return self::$sites;
}

function fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = UNISH_DRUPAL_MAJOR_VERSION, $profile = NULL, $separate_roots = FALSE) {
function fetchInstallDrupal($env = 'dev', $install = FALSE, $version_string = NULL, $profile = NULL, $separate_roots = FALSE) {
if (!$version_string) {
$version_string = UNISH_DRUPAL_MAJOR_VERSION;
}
$root = $this->webroot();
$uri = $separate_roots ? "default" : "$env";
$options = array();
Expand Down
2 changes: 1 addition & 1 deletion tests/archiveDumpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class archiveDumpCase extends CommandUnishTestCase {
*/
private function archiveDump($no_core) {
$profile = UNISH_DRUPAL_MAJOR_VERSION >= 7 ? 'testing' : 'default';
$this->fetchInstallDrupal(self::uri, TRUE, UNISH_DRUPAL_MAJOR_VERSION, $profile);
$this->fetchInstallDrupal(self::uri, TRUE, NULL, $profile);
$root = $this->webroot();
$dump_dest = UNISH_SANDBOX . DIRECTORY_SEPARATOR . 'dump.tar.gz';
$options = array(
Expand Down
10 changes: 10 additions & 0 deletions tests/bootstrap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ function unish_init() {
$unish_drupal_major = $GLOBALS['UNISH_DRUPAL_MAJOR_VERSION'];
}
define('UNISH_DRUPAL_MAJOR_VERSION', $unish_drupal_major);
$unish_drupal_minor = '';
if ($unish_drupal_major == 8) {
if (getenv('UNISH_DRUPAL_MINOR_VERSION')) {
$unish_drupal_minor = '.' . getenv('UNISH_DRUPAL_MINOR_VERSION');
}
elseif (isset($GLOBALS['UNISH_DRUPAL_MINOR_VERSION'])) {
$unish_drupal_minor = '.' . $GLOBALS['UNISH_DRUPAL_MINOR_VERSION'];
}
}
define('UNISH_DRUPAL_MINOR_VERSION', $unish_drupal_minor);

// We read from env then globals then default to mysql.
$unish_db_url = 'mysql://root:@127.0.0.1';
Expand Down
2 changes: 2 additions & 0 deletions tests/makeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ function testMakeBZ2() {
}
}

/* TODO: http://download.gna.org/wkhtmltopdf/obsolete/linux/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2 cannot be downloaded any longer
function testMakeBZ2SingleFile() {
// Silently skip bz2 test if bz2 is not installed.
exec('which bzip2', $output, $whichBzip2ErrorCode);
Expand All @@ -390,6 +391,7 @@ function testMakeBZ2SingleFile() {
$this->markTestSkipped('bzip2 command not available.');
}
}
*/

function testMakeContribDestination() {
$this->runMakefileTest('contrib-destination');
Expand Down

0 comments on commit f4d0c07

Please sign in to comment.