Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92733466
AphrontMySQLDatabaseConnectionTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 23, 06:17
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Nov 25, 06:17 (2 d)
Engine
blob
Format
Raw Data
Handle
22500005
Attached To
rPH Phabricator
AphrontMySQLDatabaseConnectionTestCase.php
View Options
<?php
final
class
AphrontMySQLDatabaseConnectionTestCase
extends
PhabricatorTestCase
{
protected
function
getPhabricatorTestCaseConfiguration
()
{
return
array
(
// We disable this here because we're testing live MySQL connections.
self
::
PHABRICATOR_TESTCONFIG_ISOLATE_LISK
=>
false
,
);
}
public
function
testConnectionFailures
()
{
$conn
=
id
(
new
HarbormasterScratchTable
())->
establishConnection
(
'r'
);
queryfx
(
$conn
,
'SELECT 1'
);
// We expect the connection to recover from a 2006 (lost connection) when
// outside of a transaction...
$conn
->
simulateErrorOnNextQuery
(
2006
);
queryfx
(
$conn
,
'SELECT 1'
);
// ...but when transactional, we expect the query to throw when the
// connection is lost, because it indicates the transaction was aborted.
$conn
->
openTransaction
();
$conn
->
simulateErrorOnNextQuery
(
2006
);
$caught
=
null
;
try
{
queryfx
(
$conn
,
'SELECT 1'
);
}
catch
(
AphrontConnectionLostQueryException
$ex
)
{
$caught
=
$ex
;
}
$this
->
assertTrue
(
$caught
instanceof
Exception
);
}
}
Event Timeline
Log In to Comment