1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 18:32:41 +01:00
phorge-phorge/src/__tests__/PhabricatorInfrastructureTestCase.php
epriestley 410c2ecbfd Remove UTF8 BMP unit test and replace it with a general UTF8 test
Summary:
Ref T1191. After utf8mb4 conversion, these tests no longer pass because MySQL allows emoji and gclefs and such.

We could keep these tests running by keeping a `ut8f_bin` table around somewhere, but we have no other use cases for it and it does not seem worth the added complexity. All these BMP-only codepaths are on the way out.

Update the `%s` / `%B` test to make sure it's rejecting invalid byte sequences, which are still not permitted.

Test Plan: Tests now pass.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10621
2014-10-02 11:47:25 -07:00

74 lines
2.2 KiB
PHP

<?php
final class PhabricatorInfrastructureTestCase extends PhabricatorTestCase {
protected function getPhabricatorTestCaseConfiguration() {
return array(
self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES => true,
);
}
/**
* This is more of an acceptance test case instead of a unit test. It verifies
* that all symbols can be loaded correctly. It can catch problems like
* missing methods in descendants of abstract base classes.
*/
public function testEverythingImplemented() {
id(new PhutilSymbolLoader())->selectAndLoadSymbols();
$this->assertTrue(true);
}
/**
* 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 testApplicationsInstalled() {
$all = PhabricatorApplication::getAllApplications();
$installed = PhabricatorApplication::getAllInstalledApplications();
$this->assertEqual(
count($all),
count($installed),
'In test cases, all applications should default to installed.');
}
public function testRejectMySQLNonUTF8Queries() {
$table = new HarbormasterScratchTable();
$conn_r = $table->establishConnection('w');
$snowman = "\xE2\x98\x83";
$invalid = "\xE6\x9D";
qsprintf($conn_r, 'SELECT %B', $snowman);
qsprintf($conn_r, 'SELECT %s', $snowman);
qsprintf($conn_r, 'SELECT %B', $invalid);
$caught = null;
try {
qsprintf($conn_r, 'SELECT %s', $invalid);
} catch (AphrontCharacterSetQueryException $ex) {
$caught = $ex;
}
$this->assertTrue($caught instanceof AphrontCharacterSetQueryException);
}
}