Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Fixed test runnig on all versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
xendk committed Apr 23, 2014
1 parent b53e9bc commit 58fd7b3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,11 @@ install:
- composer install --prefer-source
- if ( test ! -z $COVERAGE ); then mkdir cov; fi
- if ( test ! -z $COVERAGE ); then export COVERAGE=--coverage-clover=`pwd`/cov/clover.xml; fi
matrix:
allow_failures:
# Testing was changed in HEAD, allow for failure until we figure
# out how to use the new version.
- env: UNISH_DB_URL=mysql://root:@127.0.0.1 DRUSH_VERSION=dev-master COVERAGE=y
before_script:
- export BOOTSTRAP=$DRUSH_DIR/tests/drush_testcase.inc
- export CONFIG="--configuration=$DRUSH_DIR/tests"
# Disable host key checking for d.o.
- echo -e "Host git.drupal.org\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
script: phpunit --bootstrap=$BOOTSTRAP $COVERAGE tests
script: phpunit $CONFIG $COVERAGE tests
notifications:
flowdock: 78b17a3314f1bac5207d8e65e391287b
after_script:
Expand Down
13 changes: 12 additions & 1 deletion tests/bandaidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
* PHPUnit Tests for Bandaid.
*/

// The test class changed name in Drush 7, so if we're running under Drush 5/6,
// we load a class that defines the new name as a subclass to the old.
if (class_exists('Drush_CommandTestCase', FALSE)) {
require_once 'oldtest-shim.inc';
}

use Unish\CommandUnishTestCase;

/**
* Deployotron testing class.
*/
class BandaidCase extends Drush_CommandTestCase {
class BandaidCase extends CommandUnishTestCase {
/**
* Setup before running any tests.
*/
Expand Down Expand Up @@ -36,6 +44,9 @@ public function setUp() {
// Remove modules from previous test runs.
exec('rm -rf ' . $this->webroot() . '/sites/all/modules/*');
}

// Clear drush cache to ensure that it discovers the command.
$this->drush('cc', array('drush'));
}

/**
Expand Down
10 changes: 10 additions & 0 deletions tests/oldtest-shim.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

/**
* @file
* Glue class for running tests on Drush 5/6.
*/

namespace Unish;

abstract class CommandUnishTestCase extends \Drush_CommandTestCase {}

0 comments on commit 58fd7b3

Please sign in to comment.