@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.

Improve the `PhabricatorInfrastructureTestCase` unit tests

Summary:
Improve the `PhabricatorInfrastructureTestCase` unit tests such that they will fail if any of the following conditions are satisfied:

- A symbol referenced in the `__phutil_library_map__.php` file no longer exists.
- A symbol exists in the library but is not referenced within the `__phutil_library_map__.php` file.
- A symbol extends from a different parent symbol than that declared in the `__phutil_library_map.php` file.

Test Plan: See D9824.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9827

+25 -3
+25 -3
src/__tests__/PhabricatorInfrastructureTestCase.php
··· 1 1 <?php 2 2 3 - final class PhabricatorInfrastructureTestCase 4 - extends PhabricatorTestCase { 3 + final class PhabricatorInfrastructureTestCase extends PhabricatorTestCase { 5 4 6 5 protected function getPhabricatorTestCaseConfiguration() { 7 6 return array( ··· 10 9 } 11 10 12 11 /** 13 - * This is more of an acceptance test case instead of a unittest. It verifies 12 + * This is more of an acceptance test case instead of a unit test. It verifies 14 13 * that all symbols can be loaded correctly. It can catch problems like 15 14 * missing methods in descendants of abstract base classes. 16 15 */ 17 16 public function testEverythingImplemented() { 18 17 id(new PhutilSymbolLoader())->selectAndLoadSymbols(); 19 18 $this->assertTrue(true); 19 + } 20 + 21 + /** 22 + * This is more of an acceptance test case instead of a unit test. It verifies 23 + * that all the library map is up-to-date. 24 + */ 25 + public function testLibraryMap() { 26 + $root = phutil_get_library_root('phabricator'); 27 + 28 + $new_library_map = id(new PhutilLibraryMapBuilder($root)) 29 + ->setQuiet(true) 30 + ->setDryRun(true) 31 + ->buildMap(); 32 + 33 + $bootloader = PhutilBootloader::getInstance(); 34 + $old_library_map = $bootloader->getLibraryMap('phabricator'); 35 + unset($old_library_map[PhutilLibraryMapBuilder::LIBRARY_MAP_VERSION_KEY]); 36 + 37 + $this->assertEqual( 38 + $new_library_map, 39 + $old_library_map, 40 + 'The library map does not appear to be up-to-date. Try '. 41 + 'rebuilding the map with `arc liberate`.'); 20 42 } 21 43 22 44 public function testApplicationsInstalled() {