diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ec8eb4c4a8..ecbd7f7c6b 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -58,7 +58,7 @@ phutil_register_library_map(array( 'AphrontHeadsupActionView' => 'view/layout/headsup/AphrontHeadsupActionView.php', 'AphrontHeadsupView' => 'view/layout/headsup/AphrontHeadsupView.php', 'AphrontIDPagerView' => 'view/control/AphrontIDPagerView.php', - 'AphrontIsolatedDatabaseConnectionTestCase' => 'infrastructure/storage/connection/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php', + 'AphrontIsolatedDatabaseConnectionTestCase' => 'infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php', 'AphrontIsolatedHTTPSink' => 'aphront/sink/AphrontIsolatedHTTPSink.php', 'AphrontJSONResponse' => 'aphront/response/AphrontJSONResponse.php', 'AphrontJavelinView' => 'view/AphrontJavelinView.php', @@ -66,7 +66,7 @@ phutil_register_library_map(array( 'AphrontListFilterView' => 'view/layout/AphrontListFilterView.php', 'AphrontMiniPanelView' => 'view/layout/AphrontMiniPanelView.php', 'AphrontMoreView' => 'view/layout/AphrontMoreView.php', - 'AphrontMySQLDatabaseConnectionTestCase' => 'infrastructure/storage/connection/__tests__/AphrontMySQLDatabaseConnectionTestCase.php', + 'AphrontMySQLDatabaseConnectionTestCase' => 'infrastructure/storage/__tests__/AphrontMySQLDatabaseConnectionTestCase.php', 'AphrontNullView' => 'view/AphrontNullView.php', 'AphrontPHPHTTPSink' => 'aphront/sink/AphrontPHPHTTPSink.php', 'AphrontPageView' => 'view/page/AphrontPageView.php', @@ -1081,6 +1081,7 @@ phutil_register_library_map(array( 'PhrictionEditController' => 'applications/phriction/controller/PhrictionEditController.php', 'PhrictionHistoryController' => 'applications/phriction/controller/PhrictionHistoryController.php', 'PhrictionListController' => 'applications/phriction/controller/PhrictionListController.php', + 'QueryFormattingTestCase' => 'infrastructure/storage/__tests__/QueryFormattingTestCase.php', ), 'function' => array( @@ -2050,5 +2051,6 @@ phutil_register_library_map(array( 'PhrictionEditController' => 'PhrictionController', 'PhrictionHistoryController' => 'PhrictionController', 'PhrictionListController' => 'PhrictionController', + 'QueryFormattingTestCase' => 'PhabricatorTestCase', ), )); diff --git a/src/infrastructure/storage/connection/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php b/src/infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php similarity index 100% rename from src/infrastructure/storage/connection/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php rename to src/infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php diff --git a/src/infrastructure/storage/connection/__tests__/AphrontMySQLDatabaseConnectionTestCase.php b/src/infrastructure/storage/__tests__/AphrontMySQLDatabaseConnectionTestCase.php similarity index 100% rename from src/infrastructure/storage/connection/__tests__/AphrontMySQLDatabaseConnectionTestCase.php rename to src/infrastructure/storage/__tests__/AphrontMySQLDatabaseConnectionTestCase.php diff --git a/src/infrastructure/storage/__tests__/QueryFormattingTestCase.php b/src/infrastructure/storage/__tests__/QueryFormattingTestCase.php new file mode 100644 index 0000000000..a8416799bc --- /dev/null +++ b/src/infrastructure/storage/__tests__/QueryFormattingTestCase.php @@ -0,0 +1,56 @@ +establishConnection('r'); + + $this->assertEqual( + 'NULL', + qsprintf($conn_r, '%nd', null)); + + $this->assertEqual( + '0', + qsprintf($conn_r, '%nd', 0)); + + $this->assertEqual( + '0', + qsprintf($conn_r, '%d', 0)); + + $raised = null; + try { + qsprintf($conn_r, '%d', 'derp'); + } catch (Exception $ex) { + $raised = $ex; + } + $this->assertEqual( + (bool)$raised, + true, + 'qsprintf should raise exception for invalid %d conversion.'); + + $this->assertEqual( + "''", + qsprintf($conn_r, '%s', null)); + + $this->assertEqual( + 'NULL', + qsprintf($conn_r, '%ns', null)); + } + +}