@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
at recaptime-dev/main 47 lines 1.6 kB view raw
1<?php 2 3final class PhabricatorCelerityTestCase extends PhabricatorTestCase { 4 5 /** 6 * This is more of an acceptance test case instead of a unit test. It verifies 7 * that the Celerity map is up-to-date. 8 */ 9 public function testCelerityMaps() { 10 $resources_map = CelerityPhysicalResources::getAll(); 11 12 // The ../ hack works for Phorge, and that's good enough for now. 13 $phorge_path = Filesystem::resolvePath( 14 '../', 15 phutil_get_library_root('phorge')); 16 $phorge_path_len = strlen($phorge_path); 17 18 foreach ($resources_map as $resources) { 19 $map_path = $resources->getPathToMap(); 20 if (strncmp($phorge_path, $map_path, $phorge_path_len)) { 21 // This resource is from another repository 22 continue; 23 } 24 $old_map = new CelerityResourceMap($resources); 25 26 $new_map = id(new CelerityResourceMapGenerator($resources)) 27 ->generate(); 28 29 // Don't actually compare these values with assertEqual(), since the diff 30 // isn't helpful and is often enormously huge. 31 32 $maps_are_identical = 33 ($new_map->getNameMap() === $old_map->getNameMap()) && 34 ($new_map->getSymbolMap() === $old_map->getSymbolMap()) && 35 ($new_map->getRequiresMap() === $old_map->getRequiresMap()) && 36 ($new_map->getPackageMap() === $old_map->getPackageMap()); 37 38 $this->assertTrue( 39 $maps_are_identical, 40 pht( 41 'When this test fails, it means the Celerity resource map is out '. 42 'of date. Run `%s` to rebuild it.', 43 'bin/celerity map')); 44 } 45 } 46 47}