Skip to content

Commit 8d6da21

Browse files
committed
restructure tests, use composer to autoload test requirements
1 parent 8a7f11f commit 8d6da21

File tree

8 files changed

+9
-24
lines changed

8 files changed

+9
-24
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ language: php
22
php:
33
- 5.3
44
- 5.4
5+
before_script:
6+
- composer install --dev

phpunit.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit backupGlobals="false"
3+
bootstrap="test/bootstrap.php"
34
backupStaticAttributes="false"
4-
colors="false"
5+
colors="true"
56
convertErrorsToExceptions="true"
67
convertNoticesToExceptions="true"
78
convertWarningsToExceptions="true"

test/Resque/Tests/EventTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
require_once dirname(__FILE__) . '/bootstrap.php';
3-
42
/**
53
* Resque_Event tests.
64
*

test/Resque/Tests/JobStatusTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
require_once dirname(__FILE__) . '/bootstrap.php';
3-
42
/**
53
* Resque_Job_Status tests.
64
*

test/Resque/Tests/JobTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
require_once dirname(__FILE__) . '/bootstrap.php';
32

43
/**
54
* Resque_Job tests.

test/Resque/Tests/StatTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
require_once dirname(__FILE__) . '/bootstrap.php';
3-
42
/**
53
* Resque_Stat tests.
64
*

test/Resque/Tests/WorkerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<?php
2-
require_once dirname(__FILE__) . '/bootstrap.php';
3-
42
/**
53
* Resque_Worker tests.
64
*

test/Resque/Tests/bootstrap.php renamed to test/bootstrap.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,12 @@
66
* @author Chris Boulton <[email protected]>
77
* @license http://www.opensource.org/licenses/mit-license.php
88
*/
9-
define('CWD', dirname(__FILE__));
10-
define('RESQUE_LIB', CWD . '/../../../lib/');
119

12-
define('TEST_MISC', realpath(CWD . '/../../misc/'));
13-
define('REDIS_CONF', TEST_MISC . '/redis.conf');
14-
15-
// Change to the directory this file lives in. This is important, due to
16-
// how we'll be running redis.
17-
18-
require_once CWD . '/TestCase.php';
10+
$loader = require __DIR__ . '/../vendor/autoload.php';
11+
$loader->add('Resque_Tests', __DIR__);
1912

20-
// Include Resque
21-
require_once RESQUE_LIB . 'Resque.php';
22-
require_once RESQUE_LIB . 'Resque/Worker.php';
23-
require_once RESQUE_LIB . 'Resque/Redis.php';
13+
define('TEST_MISC', realpath(__DIR__ . '/misc/'));
14+
define('REDIS_CONF', TEST_MISC . '/redis.conf');
2415

2516
// Attempt to start our own redis instance for tesitng.
2617
exec('which redis-server', $output, $returnVar);
@@ -61,7 +52,7 @@ function killRedis($pid)
6152
if (file_exists($pidFile)) {
6253
$pid = trim(file_get_contents($pidFile));
6354
posix_kill((int) $pid, 9);
64-
55+
6556
if(is_file($pidFile)) {
6657
unlink($pidFile);
6758
}

0 commit comments

Comments
 (0)