From 6967ec16b3ed5b095c8af67430697cea8a60e1f9 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 6 May 2012 15:10:13 +0200 Subject: [PATCH] Add slow tests to slow group, excluded by default except for travis --- .travis.yml | 2 +- phpunit.xml.dist | 6 ++++ .../Test/Repository/PearRepositoryTest.php | 4 ++- .../Test/Repository/Vcs/GitHubDriverTest.php | 3 -- .../Test/Repository/VcsRepositoryTest.php | 18 ++++++++---- tests/Composer/Test/Util/ErrorHandlerTest.php | 2 -- tests/phpunit.xml.dist | 28 +++++++++++++++++++ 7 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 tests/phpunit.xml.dist diff --git a/.travis.yml b/.travis.yml index 9bc4e43ad..088acc22b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ before_script: - wget -nc http://getcomposer.org/composer.phar - php composer.phar install -script: phpunit +script: phpunit -c tests/ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 246d305e4..7fc3db741 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -17,6 +17,12 @@ + + + slow + + + ./src/Composer/ diff --git a/tests/Composer/Test/Repository/PearRepositoryTest.php b/tests/Composer/Test/Repository/PearRepositoryTest.php index fd353d7ff..4df45449d 100644 --- a/tests/Composer/Test/Repository/PearRepositoryTest.php +++ b/tests/Composer/Test/Repository/PearRepositoryTest.php @@ -15,9 +15,11 @@ namespace Composer\Repository; use Composer\Repository\FilesystemRepository; use Composer\Test\TestCase; +/** + * @group slow + */ class PearRepositoryTest extends TestCase { - /** * @var PearRepository */ diff --git a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php index 88483bff8..064e870f9 100644 --- a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php @@ -17,9 +17,6 @@ use Composer\Repository\Vcs\GitHubDriver; use Composer\Util\Filesystem; use Composer\Config; -/** - * @author Beau Simensen - */ class GitHubDriverTest extends \PHPUnit_Framework_TestCase { public function testPrivateRepository() diff --git a/tests/Composer/Test/Repository/VcsRepositoryTest.php b/tests/Composer/Test/Repository/VcsRepositoryTest.php index c2060d5b7..8c04c4b0b 100644 --- a/tests/Composer/Test/Repository/VcsRepositoryTest.php +++ b/tests/Composer/Test/Repository/VcsRepositoryTest.php @@ -21,23 +21,26 @@ use Composer\Util\ProcessExecutor; use Composer\IO\NullIO; use Composer\Config; +/** + * @group slow + */ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase { private static $gitRepo; - private static $skipped; + private $skipped; - public static function setUpBeforeClass() + protected function initialize() { $oldCwd = getcwd(); self::$gitRepo = sys_get_temp_dir() . '/composer-git-'.rand().'/'; $locator = new ExecutableFinder(); if (!$locator->find('git')) { - self::$skipped = 'This test needs a git binary in the PATH to be able to run'; + $this->skipped = 'This test needs a git binary in the PATH to be able to run'; return; } if (!mkdir(self::$gitRepo) || !chdir(self::$gitRepo)) { - self::$skipped = 'Could not create and move into the temp git repo '.self::$gitRepo; + $this->skipped = 'Could not create and move into the temp git repo '.self::$gitRepo; return; } @@ -101,8 +104,11 @@ class VcsRepositoryTest extends \PHPUnit_Framework_TestCase public function setUp() { - if (self::$skipped) { - $this->markTestSkipped(self::$skipped); + if (!self::$gitRepo) { + $this->initialize(); + } + if ($this->skipped) { + $this->markTestSkipped($this->skipped); } } diff --git a/tests/Composer/Test/Util/ErrorHandlerTest.php b/tests/Composer/Test/Util/ErrorHandlerTest.php index 7232606e2..e24fe3f39 100644 --- a/tests/Composer/Test/Util/ErrorHandlerTest.php +++ b/tests/Composer/Test/Util/ErrorHandlerTest.php @@ -17,8 +17,6 @@ use Composer\Test\TestCase; /** * ErrorHandler test case - * - * @author Artem Lopata */ class ErrorHandlerTest extends TestCase { diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist new file mode 100644 index 000000000..6b3543029 --- /dev/null +++ b/tests/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + + ./Composer/ + + + + + + ../src/Composer/ + + ../src/Composer/Autoload/ClassLoader.php + + + +