diff --git a/src/applications/releeph/application/PhabricatorReleephApplication.php b/src/applications/releeph/application/PhabricatorReleephApplication.php index 91e8246f85..e04337f912 100644 --- a/src/applications/releeph/application/PhabricatorReleephApplication.php +++ b/src/applications/releeph/application/PhabricatorReleephApplication.php @@ -1,84 +1,81 @@ [1-9]\d*)' => 'ReleephRequestViewController', // TODO: Remove these older routes eventually. '/RQ(?P[1-9]\d*)' => 'ReleephRequestViewController', '/releeph/request/(?P[1-9]\d*)/' => 'ReleephRequestViewController', '/releeph/' => array( '' => 'ReleephProductListController', '(?:product|project)/' => array( '(?:query/(?P[^/]+)/)?' => 'ReleephProductListController', 'create/' => 'ReleephProductCreateController', '(?P[1-9]\d*)/' => array( '(?:query/(?P[^/]+)/)?' => 'ReleephProductViewController', 'edit/' => 'ReleephProductEditController', 'cutbranch/' => 'ReleephBranchCreateController', 'action/(?P.+)/' => 'ReleephProductActionController', 'history/' => 'ReleephProductHistoryController', ), ), 'branch/' => array( 'edit/(?P[1-9]\d*)/' => 'ReleephBranchEditController', '(?Pclose|re-open)/(?P[1-9]\d*)/' => 'ReleephBranchAccessController', 'preview/' => 'ReleephBranchNamePreviewController', '(?P[1-9]\d*)/' => array( 'history/' => 'ReleephBranchHistoryController', '(?:query/(?P[^/]+)/)?' => 'ReleephBranchViewController', ), 'pull/(?P[1-9]\d*)/' => 'ReleephRequestEditController', ), 'request/' => array( 'create/' => 'ReleephRequestEditController', 'differentialcreate/' => array( 'D(?P[1-9]\d*)' => 'ReleephRequestDifferentialCreateController', ), 'edit/(?P[1-9]\d*)/' => 'ReleephRequestEditController', 'action/(?P.+)/(?P[1-9]\d*)/' => 'ReleephRequestActionController', 'typeahead/' => 'ReleephRequestTypeaheadController', 'comment/(?P[1-9]\d*)/' => 'ReleephRequestCommentController', ), ) ); } } diff --git a/src/applications/releeph/config/PhabricatorReleephApplicationConfigOptions.php b/src/applications/releeph/config/PhabricatorReleephApplicationConfigOptions.php index 6f54a7ceb2..dc62b59166 100644 --- a/src/applications/releeph/config/PhabricatorReleephApplicationConfigOptions.php +++ b/src/applications/releeph/config/PhabricatorReleephApplicationConfigOptions.php @@ -1,72 +1,59 @@ getFieldKey()] = true; } foreach ($default as $key => $enabled) { $default[$key] = array( 'disabled' => !$enabled, ); } $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType'; return array( - $this->newOption('releeph.installed', 'bool', false) - ->setSummary(pht('Enable the Releeph application.')) - ->setDescription( - pht( - 'Releeph, a tool for managing release branches, will eventually '. - 'fit in to the Phabricator suite as a general purpose tool. '. - 'However Releeph is currently unstable in multiple ways that may '. - 'not migrate properly for you: the code is still in alpha stage '. - 'of design, the storage format is likely to change in unexpected '. - 'ways, and the workflows presented are very specific to a core '. - 'set of alpha testers at Facebook. For the time being you are '. - 'strongly discouraged from relying on Releeph being at all '. - 'stable.')), $this->newOption('releeph.fields', $custom_field_type, $default) ->setCustomData('ReleephFieldSpecification'), $this->newOption( 'releeph.default-branch-template', 'string', 'releases/%P/%p-%Y%m%d-%v') ->setDescription( pht( 'The default branch template for new branches in unconfigured '. 'Releeph projects. This is also configurable on a per-project '. 'basis.')), ); } } diff --git a/src/infrastructure/testing/PhabricatorTestCase.php b/src/infrastructure/testing/PhabricatorTestCase.php index 14e2a30142..effec47d86 100644 --- a/src/infrastructure/testing/PhabricatorTestCase.php +++ b/src/infrastructure/testing/PhabricatorTestCase.php @@ -1,225 +1,222 @@ getPhabricatorTestCaseConfiguration() + array( self::PHABRICATOR_TESTCONFIG_ISOLATE_LISK => true, self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => false, ); if ($config[self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES]) { // Fixtures don't make sense with process isolation. $config[self::PHABRICATOR_TESTCONFIG_ISOLATE_LISK] = false; } return $config; } public function willRunTestCases(array $test_cases) { $root = dirname(phutil_get_library_root('phabricator')); require_once $root.'/scripts/__init_script__.php'; $config = $this->getComputedConfiguration(); if ($config[self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES]) { ++self::$storageFixtureReferences; if (!self::$storageFixture) { self::$storageFixture = $this->newStorageFixture(); } } ++self::$testsAreRunning; } public function didRunTestCases(array $test_cases) { if (self::$storageFixture) { self::$storageFixtureReferences--; if (!self::$storageFixtureReferences) { self::$storageFixture = null; } } --self::$testsAreRunning; } protected function willRunTests() { $config = $this->getComputedConfiguration(); if ($config[self::PHABRICATOR_TESTCONFIG_ISOLATE_LISK]) { LiskDAO::beginIsolateAllLiskEffectsToCurrentProcess(); } $this->env = PhabricatorEnv::beginScopedEnv(); // NOTE: While running unit tests, we act as though all applications are // installed, regardless of the install's configuration. Tests which need // to uninstall applications are responsible for adjusting state themselves // (such tests are exceedingly rare). $this->env->overrideEnvConfig( 'phabricator.uninstalled-applications', array()); $this->env->overrideEnvConfig( 'phabricator.show-prototypes', true); // Reset application settings to defaults, particularly policies. $this->env->overrideEnvConfig( 'phabricator.application-settings', array()); // We can't stub this service right now, and it's not generally useful // to publish notifications about test execution. $this->env->overrideEnvConfig( 'notification.enabled', false); - // TODO: Remove this when we remove "releeph.installed". - $this->env->overrideEnvConfig('releeph.installed', true); - $this->env->overrideEnvConfig( 'phabricator.base-uri', 'http://phabricator.example.com'); } protected function didRunTests() { $config = $this->getComputedConfiguration(); if ($config[self::PHABRICATOR_TESTCONFIG_ISOLATE_LISK]) { LiskDAO::endIsolateAllLiskEffectsToCurrentProcess(); } try { if (phutil_is_hiphop_runtime()) { $this->env->__destruct(); } unset($this->env); } catch (Exception $ex) { throw new Exception( 'Some test called PhabricatorEnv::beginScopedEnv(), but is still '. 'holding a reference to the scoped environment!'); } } protected function willRunOneTest($test) { $config = $this->getComputedConfiguration(); if ($config[self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES]) { LiskDAO::beginIsolateAllLiskEffectsToTransactions(); } } protected function didRunOneTest($test) { $config = $this->getComputedConfiguration(); if ($config[self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES]) { LiskDAO::endIsolateAllLiskEffectsToTransactions(); } } protected function newStorageFixture() { $bytes = Filesystem::readRandomCharacters(24); $name = self::NAMESPACE_PREFIX.$bytes; return new PhabricatorStorageFixtureScopeGuard($name); } protected function getLink($method) { $phabricator_project = 'PHID-APRJ-3f1fc779edeab89b2171'; return 'https://secure.phabricator.com/diffusion/symbol/'.$method. '/?lang=php&projects='.$phabricator_project. '&jump=true&context='.get_class($this); } /** * Returns an integer seed to use when building unique identifiers (e.g., * non-colliding usernames). The seed is unstable and its value will change * between test runs, so your tests must not rely on it. * * @return int A unique integer. */ protected function getNextObjectSeed() { self::$storageFixtureObjectSeed += mt_rand(1, 100); return self::$storageFixtureObjectSeed; } protected function generateNewTestUser() { $seed = $this->getNextObjectSeed(); $user = id(new PhabricatorUser()) ->setRealName("Test User {$seed}}") ->setUserName("test{$seed}") ->setIsApproved(1); $email = id(new PhabricatorUserEmail()) ->setAddress("testuser{$seed}@example.com") ->setIsVerified(1); $editor = new PhabricatorUserEditor(); $editor->setActor($user); $editor->createNewUser($user, $email); return $user; } /** * Throws unless tests are currently executing. This method can be used to * guard code which is specific to unit tests and should not normally be * reachable. * * If tests aren't currently being executed, throws an exception. */ public static function assertExecutingUnitTests() { if (!self::$testsAreRunning) { throw new Exception( 'Executing test code outside of test execution! This code path can '. 'only be run during unit tests.'); } } }