Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93231180
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
Wed, Nov 27, 05:10
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 29, 05:10 (2 d)
Engine
blob
Format
Raw Data
Handle
22597237
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