restructure tests, use composer to autoload test requirements

This commit is contained in:
Chris Boulton 2013-01-12 22:01:13 +11:00
parent 8a7f11f906
commit 8d6da21473
8 changed files with 9 additions and 24 deletions

View File

@ -2,3 +2,5 @@ language: php
php: php:
- 5.3 - 5.3
- 5.4 - 5.4
before_script:
- composer install --dev

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" <phpunit backupGlobals="false"
bootstrap="test/bootstrap.php"
backupStaticAttributes="false" backupStaticAttributes="false"
colors="false" colors="true"
convertErrorsToExceptions="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertNoticesToExceptions="true"
convertWarningsToExceptions="true" convertWarningsToExceptions="true"

View File

@ -1,6 +1,4 @@
<?php <?php
require_once dirname(__FILE__) . '/bootstrap.php';
/** /**
* Resque_Event tests. * Resque_Event tests.
* *

View File

@ -1,6 +1,4 @@
<?php <?php
require_once dirname(__FILE__) . '/bootstrap.php';
/** /**
* Resque_Job_Status tests. * Resque_Job_Status tests.
* *

View File

@ -1,5 +1,4 @@
<?php <?php
require_once dirname(__FILE__) . '/bootstrap.php';
/** /**
* Resque_Job tests. * Resque_Job tests.

View File

@ -1,6 +1,4 @@
<?php <?php
require_once dirname(__FILE__) . '/bootstrap.php';
/** /**
* Resque_Stat tests. * Resque_Stat tests.
* *

View File

@ -1,6 +1,4 @@
<?php <?php
require_once dirname(__FILE__) . '/bootstrap.php';
/** /**
* Resque_Worker tests. * Resque_Worker tests.
* *

View File

@ -6,22 +6,13 @@
* @author Chris Boulton <chris@bigcommerce.com> * @author Chris Boulton <chris@bigcommerce.com>
* @license http://www.opensource.org/licenses/mit-license.php * @license http://www.opensource.org/licenses/mit-license.php
*/ */
define('CWD', dirname(__FILE__));
define('RESQUE_LIB', CWD . '/../../../lib/');
define('TEST_MISC', realpath(CWD . '/../../misc/')); $loader = require __DIR__ . '/../vendor/autoload.php';
$loader->add('Resque_Tests', __DIR__);
define('TEST_MISC', realpath(__DIR__ . '/misc/'));
define('REDIS_CONF', TEST_MISC . '/redis.conf'); define('REDIS_CONF', TEST_MISC . '/redis.conf');
// Change to the directory this file lives in. This is important, due to
// how we'll be running redis.
require_once CWD . '/TestCase.php';
// Include Resque
require_once RESQUE_LIB . 'Resque.php';
require_once RESQUE_LIB . 'Resque/Worker.php';
require_once RESQUE_LIB . 'Resque/Redis.php';
// Attempt to start our own redis instance for tesitng. // Attempt to start our own redis instance for tesitng.
exec('which redis-server', $output, $returnVar); exec('which redis-server', $output, $returnVar);
if($returnVar != 0) { if($returnVar != 0) {
@ -61,7 +52,7 @@ function killRedis($pid)
if (file_exists($pidFile)) { if (file_exists($pidFile)) {
$pid = trim(file_get_contents($pidFile)); $pid = trim(file_get_contents($pidFile));
posix_kill((int) $pid, 9); posix_kill((int) $pid, 9);
if(is_file($pidFile)) { if(is_file($pidFile)) {
unlink($pidFile); unlink($pidFile);
} }