Remove product literal strings in "pht()", part 18
[phabricator.git] / src / infrastructure / storage / __tests__ / AphrontMySQLDatabaseConnectionTestCase.php
blobec238ecd594a8c60684beb4905bdc647c7e94add
1 <?php
3 final class AphrontMySQLDatabaseConnectionTestCase
4 extends PhabricatorTestCase {
6 protected function getPhabricatorTestCaseConfiguration() {
7 return array(
8 // We disable this here because we're testing live MySQL connections.
9 self::PHABRICATOR_TESTCONFIG_ISOLATE_LISK => false,
13 public function testConnectionFailures() {
14 $conn = id(new HarbormasterScratchTable())->establishConnection('r');
16 queryfx($conn, 'SELECT 1');
18 // We expect the connection to recover from a 2006 (lost connection) when
19 // outside of a transaction...
20 $conn->simulateErrorOnNextQuery(2006);
21 queryfx($conn, 'SELECT 1');
23 // ...but when transactional, we expect the query to throw when the
24 // connection is lost, because it indicates the transaction was aborted.
25 $conn->openTransaction();
26 $conn->simulateErrorOnNextQuery(2006);
28 $caught = null;
29 try {
30 queryfx($conn, 'SELECT 1');
31 } catch (AphrontConnectionLostQueryException $ex) {
32 $caught = $ex;
34 $this->assertTrue($caught instanceof Exception);