[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/__tests__/ -> PhabricatorInfrastructureTestCase.php (source)

   1  <?php
   2  
   3  final class PhabricatorInfrastructureTestCase extends PhabricatorTestCase {
   4  
   5    protected function getPhabricatorTestCaseConfiguration() {
   6      return array(
   7        self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true,
   8      );
   9    }
  10  
  11    /**
  12     * This is more of an acceptance test case instead of a unit test. It verifies
  13     * that all symbols can be loaded correctly. It can catch problems like
  14     * missing methods in descendants of abstract base classes.
  15     */
  16    public function testEverythingImplemented() {
  17      id(new PhutilSymbolLoader())->selectAndLoadSymbols();
  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      $library = phutil_get_current_library_name();
  27      $root = phutil_get_library_root($library);
  28  
  29      $new_library_map = id(new PhutilLibraryMapBuilder($root))
  30        ->buildMap();
  31  
  32      $bootloader = PhutilBootloader::getInstance();
  33      $old_library_map = $bootloader->getLibraryMapWithoutExtensions($library);
  34      unset($old_library_map[PhutilLibraryMapBuilder::LIBRARY_MAP_VERSION_KEY]);
  35  
  36      $this->assertEqual(
  37        $new_library_map,
  38        $old_library_map,
  39        'The library map does not appear to be up-to-date. Try '.
  40        'rebuilding the map with `arc liberate`.');
  41    }
  42  
  43    public function testApplicationsInstalled() {
  44      $all = PhabricatorApplication::getAllApplications();
  45      $installed = PhabricatorApplication::getAllInstalledApplications();
  46  
  47      $this->assertEqual(
  48        count($all),
  49        count($installed),
  50        'In test cases, all applications should default to installed.');
  51    }
  52  
  53    public function testRejectMySQLNonUTF8Queries() {
  54      $table = new HarbormasterScratchTable();
  55      $conn_r = $table->establishConnection('w');
  56  
  57      $snowman = "\xE2\x98\x83";
  58      $invalid = "\xE6\x9D";
  59  
  60      qsprintf($conn_r, 'SELECT %B', $snowman);
  61      qsprintf($conn_r, 'SELECT %s', $snowman);
  62      qsprintf($conn_r, 'SELECT %B', $invalid);
  63  
  64      $caught = null;
  65      try {
  66        qsprintf($conn_r, 'SELECT %s', $invalid);
  67      } catch (AphrontCharacterSetQueryException $ex) {
  68        $caught = $ex;
  69      }
  70  
  71      $this->assertTrue($caught instanceof AphrontCharacterSetQueryException);
  72    }
  73  
  74  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1