Skip to content

Commit 6967ec1

Browse files
committed
Add slow tests to slow group, excluded by default except for travis
1 parent b1eb47b commit 6967ec1

7 files changed

+50
-13
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ before_script:
99
- wget -nc http://getcomposer.org/composer.phar
1010
- php composer.phar install
1111

12-
script: phpunit
12+
script: phpunit -c tests/

phpunit.xml.dist

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
</testsuite>
1818
</testsuites>
1919

20+
<groups>
21+
<exclude>
22+
<group>slow</group>
23+
</exclude>
24+
</groups>
25+
2026
<filter>
2127
<whitelist>
2228
<directory>./src/Composer/</directory>

tests/Composer/Test/Repository/PearRepositoryTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
use Composer\Repository\FilesystemRepository;
1616
use Composer\Test\TestCase;
1717

18+
/**
19+
* @group slow
20+
*/
1821
class PearRepositoryTest extends TestCase
1922
{
20-
2123
/**
2224
* @var PearRepository
2325
*/

tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
use Composer\Util\Filesystem;
1818
use Composer\Config;
1919

20-
/**
21-
* @author Beau Simensen <[email protected]>
22-
*/
2320
class GitHubDriverTest extends \PHPUnit_Framework_TestCase
2421
{
2522
public function testPrivateRepository()

tests/Composer/Test/Repository/VcsRepositoryTest.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,26 @@
2121
use Composer\IO\NullIO;
2222
use Composer\Config;
2323

24+
/**
25+
* @group slow
26+
*/
2427
class VcsRepositoryTest extends \PHPUnit_Framework_TestCase
2528
{
2629
private static $gitRepo;
27-
private static $skipped;
30+
private $skipped;
2831

29-
public static function setUpBeforeClass()
32+
protected function initialize()
3033
{
3134
$oldCwd = getcwd();
3235
self::$gitRepo = sys_get_temp_dir() . '/composer-git-'.rand().'/';
3336

3437
$locator = new ExecutableFinder();
3538
if (!$locator->find('git')) {
36-
self::$skipped = 'This test needs a git binary in the PATH to be able to run';
39+
$this->skipped = 'This test needs a git binary in the PATH to be able to run';
3740
return;
3841
}
3942
if (!mkdir(self::$gitRepo) || !chdir(self::$gitRepo)) {
40-
self::$skipped = 'Could not create and move into the temp git repo '.self::$gitRepo;
43+
$this->skipped = 'Could not create and move into the temp git repo '.self::$gitRepo;
4144
return;
4245
}
4346

@@ -101,8 +104,11 @@ public static function setUpBeforeClass()
101104

102105
public function setUp()
103106
{
104-
if (self::$skipped) {
105-
$this->markTestSkipped(self::$skipped);
107+
if (!self::$gitRepo) {
108+
$this->initialize();
109+
}
110+
if ($this->skipped) {
111+
$this->markTestSkipped($this->skipped);
106112
}
107113
}
108114

tests/Composer/Test/Util/ErrorHandlerTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
/**
1919
* ErrorHandler test case
20-
*
21-
* @author Artem Lopata <[email protected]>
2220
*/
2321
class ErrorHandlerTest extends TestCase
2422
{

tests/phpunit.xml.dist

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
bootstrap="./bootstrap.php"
13+
>
14+
<testsuites>
15+
<testsuite name="Full Composer Test Suite">
16+
<directory>./Composer/</directory>
17+
</testsuite>
18+
</testsuites>
19+
20+
<filter>
21+
<whitelist>
22+
<directory>../src/Composer/</directory>
23+
<exclude>
24+
<file>../src/Composer/Autoload/ClassLoader.php</file>
25+
</exclude>
26+
</whitelist>
27+
</filter>
28+
</phpunit>

0 commit comments

Comments
 (0)