/** * This is more of an acceptance test case instead of a unit test. It verifies * that all the library map is up-to-date. */ public function testLibraryMap() { $library = phutil_get_current_library_name(); $root = phutil_get_library_root($library); $new_library_map = id(new PhutilLibraryMapBuilder($root))->buildMap(); $bootloader = PhutilBootloader::getInstance(); $old_library_map = $bootloader->getLibraryMapWithoutExtensions($library); unset($old_library_map[PhutilLibraryMapBuilder::LIBRARY_MAP_VERSION_KEY]); $this->assertEqual($new_library_map, $old_library_map, 'The library map does not appear to be up-to-date. Try ' . 'rebuilding the map with `arc liberate`.'); }
public function testGetTestPaths() { $tests = array('empty' => array(array(), array()), 'test file' => array(array(__FILE__), array(__FILE__)), 'test directory' => array(array(dirname(__FILE__)), array(dirname(dirname(__FILE__)) . '/__tests__/__tests__/', dirname(dirname(__FILE__)) . '/__tests__/', dirname(dirname(dirname(__FILE__))) . '/__tests__/', phutil_get_library_root('arcanist') . '/__tests__/')), 'normal directory' => array(array(dirname(dirname(__FILE__))), array(dirname(dirname(__FILE__)) . '/__tests__/', dirname(dirname(dirname(__FILE__))) . '/__tests__/', phutil_get_library_root('arcanist') . '/__tests__/')), 'library root' => array(array(phutil_get_library_root('arcanist')), array(phutil_get_library_root('arcanist') . '/__tests__/'))); $test_engine = id(new PhutilUnitTestEngine())->setWorkingCopy($this->getWorkingCopy()); $library = phutil_get_current_library_name(); $library_root = phutil_get_library_root($library); foreach ($tests as $name => $test) { list($paths, $test_paths) = $test; $expected = array(); foreach ($test_paths as $path) { $expected[] = array('library' => $library, 'path' => Filesystem::readablePath($path, $library_root)); } $test_engine->setPaths($paths); $this->assertEqual($expected, array_values($test_engine->getTestPaths()), pht('Test paths for: "%s"', $name)); } }
public function testGetCurrentLibraryName() { $this->assertEqual('phutil', phutil_get_current_library_name()); }