diff --git a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php index b46fb4188b..1e9c83da26 100644 --- a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php +++ b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php @@ -15,6 +15,8 @@ final class PhabricatorWorkingCopyDiscoveryTestCase } public function testMercurialCommitDiscovery() { + $this->requireBinaryForTest('hg'); + $refs = $this->discoverRefs('HT'); $this->assertEqual( array( diff --git a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyPullTestCase.php b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyPullTestCase.php index 58a6590871..83568f3496 100644 --- a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyPullTestCase.php +++ b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyPullTestCase.php @@ -10,6 +10,7 @@ final class PhabricatorWorkingCopyPullTestCase } public function testHgPullBasic() { + $this->requireBinaryForTest('hg'); $repo = $this->buildPulledRepository('HT'); $this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/.hg')); diff --git a/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php b/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php index bcb21a6de8..7efc3a4a18 100644 --- a/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php +++ b/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php @@ -203,6 +203,8 @@ final class PhabricatorChangeParserTestCase } public function testMercurialParser() { + $this->requireBinaryForTest('hg'); + $repository = $this->buildDiscoveredRepository('CHB'); $viewer = PhabricatorUser::getOmnipotentUser(); diff --git a/src/infrastructure/testing/PhabricatorTestCase.php b/src/infrastructure/testing/PhabricatorTestCase.php index effec47d86..53950ddf73 100644 --- a/src/infrastructure/testing/PhabricatorTestCase.php +++ b/src/infrastructure/testing/PhabricatorTestCase.php @@ -218,5 +218,12 @@ abstract class PhabricatorTestCase extends ArcanistPhutilTestCase { } } + protected function requireBinaryForTest($binary) { + if (!Filesystem::binaryExists($binary)) { + $this->assertSkipped( + pht('No binary "%s" found on this system, skipping test.', $binary)); + } + } + }