Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/__tests__/PHPUnitTestEngineTestCase.php
<?php | <?php | ||||
/** | /** | ||||
* Tests for @{class:PHPUnitTestEngine}. | * Tests for @{class:PHPUnitTestEngine}. | ||||
*/ | */ | ||||
final class PHPUnitTestEngineTestCase extends ArcanistTestCase { | final class PHPUnitTestEngineTestCase extends ArcanistTestCase { | ||||
public function testSearchLocations() { | public function testSearchLocations() { | ||||
$path = '/path/to/some/file/X.php'; | $path = '/path/to/some/file/X.php'; | ||||
$root = dirname(phutil_get_library_root('arcanist')); | |||||
$working_copy = ArcanistWorkingCopyIdentity::newFromPath($root); | |||||
$configuration_manager = new ArcanistConfigurationManager(); | |||||
$configuration_manager->setWorkingCopyIdentity($working_copy); | |||||
$phpunitTestEngine = new PhpunitTestEngine(); | |||||
$phpunitTestEngine->setConfigurationManager($configuration_manager); | |||||
$this->assertEqual( | $this->assertEqual( | ||||
array( | array( | ||||
'/path/to/some/file/', | '/path/to/some/file/', | ||||
'/path/to/some/file/tests/', | '/path/to/some/file/tests/', | ||||
'/path/to/some/file/Tests/', | '/path/to/some/file/Tests/', | ||||
'/path/to/some/tests/', | '/path/to/some/tests/', | ||||
'/path/to/some/Tests/', | '/path/to/some/Tests/', | ||||
'/path/to/tests/', | '/path/to/tests/', | ||||
Show All 12 Lines | $this->assertEqual( | ||||
'/path/to/some/Tests/file/', | '/path/to/some/Tests/file/', | ||||
'/path/to/tests/some/file/', | '/path/to/tests/some/file/', | ||||
'/path/to/Tests/some/file/', | '/path/to/Tests/some/file/', | ||||
'/path/tests/to/some/file/', | '/path/tests/to/some/file/', | ||||
'/path/Tests/to/some/file/', | '/path/Tests/to/some/file/', | ||||
'/tests/path/to/some/file/', | '/tests/path/to/some/file/', | ||||
'/Tests/path/to/some/file/', | '/Tests/path/to/some/file/', | ||||
), | ), | ||||
PhpunitTestEngine::getSearchLocationsForTests($path)); | $phpunitTestEngine->getSearchLocationsForTests($path)); | ||||
} | |||||
public function testConfiguredSearchLocations() { | |||||
$path = '/path/to/some/file/X.php'; | |||||
$root = dirname(phutil_get_library_root('arcanist')); | |||||
$working_copy = ArcanistWorkingCopyIdentity::newFromPath($root); | |||||
$configuration_manager = new ArcanistConfigurationManager(); | |||||
$configuration_manager->setWorkingCopyIdentity($working_copy); | |||||
$configuration_manager->setRuntimeConfig( | |||||
'phpunit_test_dirs', array('tests/Unit')); | |||||
$phpunitTestEngine = new PhpunitTestEngine(); | |||||
$phpunitTestEngine->setConfigurationManager($configuration_manager); | |||||
$this->assertEqual( | |||||
array( | |||||
'/path/to/some/file/', | |||||
'/path/to/some/file/tests/Unit/', | |||||
'/path/to/some/tests/Unit/', | |||||
'/path/to/tests/Unit/', | |||||
'/path/tests/Unit/', | |||||
'/tests/Unit/', | |||||
'/path/to/tests/Unit/file/', | |||||
'/path/tests/Unit/some/file/', | |||||
'/tests/Unit/to/some/file/', | |||||
'/path/to/some/tests/Unit/file/', | |||||
'/path/to/tests/Unit/some/file/', | |||||
'/path/tests/Unit/to/some/file/', | |||||
'/tests/Unit/path/to/some/file/', | |||||
), | |||||
$phpunitTestEngine->getSearchLocationsForTests($path)); | |||||
} | } | ||||
} | } |