@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a custom unit test engine to check the Celerity map is up to date on CSS/JS changes

Summary: Fixes T15209. See T15209#28447 for why I did things this way.

Test Plan:
- Make sure you have no uncommitted local changes
- Run `arc unit --rev HEAD` (this tells Arcanist to only process uncommitted chanegs and not the changes to the PHP files made in this commit)
- See no output (neither test engine found anything to run)
- Modify a CSS or JS file
- Run `arc unit --rev HEAD`
- See a failure message about the Celerity map being out of date and no other tests having run.
- Modify a PHP file inside `src/`
- Run `arc unit --rev HEAD`
- See the standard suite of tests run as normal.

Reviewers: O1 Blessed Committers, mainframe98, avivey

Reviewed By: O1 Blessed Committers, mainframe98, avivey

Subscribers: avivey, mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15209

Differential Revision: https://we.phorge.it/D26577

Pppery 71500d2b 40f95f98

+37
+4
.arcunit
··· 3 3 "phutil": { 4 4 "type": "phutil", 5 5 "include": "(\\.php$)" 6 + }, 7 + "celerity": { 8 + "type": "celerity", 9 + "include": "(\\.(css|js)$)" 6 10 } 7 11 } 8 12 }
+2
src/__phutil_library_map__.php
··· 338 338 'CelerityResourcesOnDisk' => 'applications/celerity/resources/CelerityResourcesOnDisk.php', 339 339 'CeleritySpriteGenerator' => 'applications/celerity/CeleritySpriteGenerator.php', 340 340 'CelerityStaticResourceResponse' => 'applications/celerity/CelerityStaticResourceResponse.php', 341 + 'CelerityUnitTestEngine' => 'applications/celerity/CelerityUnitTestEngine.php', 341 342 'ConduitAPIDocumentationPage' => 'applications/conduit/data/ConduitAPIDocumentationPage.php', 342 343 'ConduitAPIMethod' => 'applications/conduit/method/ConduitAPIMethod.php', 343 344 'ConduitAPIMethodTestCase' => 'applications/conduit/method/__tests__/ConduitAPIMethodTestCase.php', ··· 6361 6362 'CelerityResourcesOnDisk' => 'CelerityPhysicalResources', 6362 6363 'CeleritySpriteGenerator' => 'Phobject', 6363 6364 'CelerityStaticResourceResponse' => 'Phobject', 6365 + 'CelerityUnitTestEngine' => 'ArcanistUnitTestEngine', 6364 6366 'ConduitAPIDocumentationPage' => 'Phobject', 6365 6367 'ConduitAPIMethod' => array( 6366 6368 'Phobject',
+31
src/applications/celerity/CelerityUnitTestEngine.php
··· 1 + <?php 2 + 3 + /** 4 + * Custom engine to run the celerity map tests on CSS or JS pages 5 + */ 6 + final class CelerityUnitTestEngine extends ArcanistUnitTestEngine { 7 + 8 + public function getEngineConfigurationName() { 9 + return 'celerity'; 10 + } 11 + 12 + protected function supportsRunAllTests() { 13 + return true; 14 + } 15 + 16 + public function run() { 17 + if ($this->getRunAllTests() || $this->getPaths()) { 18 + $test_case = new PhabricatorCelerityTestCase(); 19 + $test_case->willRunTestCases(array($test_case)); 20 + $test_case->setWorkingCopy($this->getWorkingCopy()); 21 + if ($this->renderer) { 22 + $test_case->setRenderer($this->renderer); 23 + } 24 + $result = $test_case->run(); 25 + $test_case->didRunTestCases(array($test_case)); 26 + return $result; 27 + } 28 + return array(); 29 + } 30 + 31 + }