From 8d6da214732179b223252f3bcb21ece9558f2af0 Mon Sep 17 00:00:00 2001 From: Chris Boulton Date: Sat, 12 Jan 2013 22:01:13 +1100 Subject: [PATCH] restructure tests, use composer to autoload test requirements --- .travis.yml | 2 ++ phpunit.xml | 3 ++- test/Resque/Tests/EventTest.php | 2 -- test/Resque/Tests/JobStatusTest.php | 2 -- test/Resque/Tests/JobTest.php | 1 - test/Resque/Tests/StatTest.php | 2 -- test/Resque/Tests/WorkerTest.php | 2 -- test/{Resque/Tests => }/bootstrap.php | 19 +++++-------------- 8 files changed, 9 insertions(+), 24 deletions(-) rename test/{Resque/Tests => }/bootstrap.php (86%) diff --git a/.travis.yml b/.travis.yml index 625062e..b1b8e8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,3 +2,5 @@ language: php php: - 5.3 - 5.4 +before_script: + - composer install --dev \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml index efbc7f2..61d2d7b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,8 @@ * @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'); -// 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. exec('which redis-server', $output, $returnVar); if($returnVar != 0) { @@ -61,7 +52,7 @@ function killRedis($pid) if (file_exists($pidFile)) { $pid = trim(file_get_contents($pidFile)); posix_kill((int) $pid, 9); - + if(is_file($pidFile)) { unlink($pidFile); }