Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DeadlockException example
$receiver
=
new
DoctrineReceiver
(
$connection
,
$serializer
)
;
$receiver
->
get
(
)
;
}
public
function
testOccursRetryableExceptionFromConnection
(
)
{
$serializer
=
$this
->
createSerializer
(
)
;
$connection
=
$this
->
createMock
(
Connection::
class
)
;
$driverException
=
class_exists
(
Exception::
class
)
? Exception::
new
(
new
\
PDOException
(
'Deadlock', 40001
)
)
:
new
PDOException
(
new
\
PDOException
(
'Deadlock', 40001
)
)
;
if
(
!
class_exists
(
Version::
class
)
)
{
// This is doctrine/dbal 3.x
$deadlockException
=
new
DeadlockException
(
$driverException
, null
)
;
}
else
{
$deadlockException
=
new
DeadlockException
(
'Deadlock',
$driverException
)
;
}
$connection
->
method
(
'get'
)
->
willThrowException
(
$deadlockException
)
;
$receiver
=
new
DoctrineReceiver
(
$connection
,
$serializer
)
;
$this
->
assertSame
(
[
]
,
$receiver
->
get
(
)
)
;
$this
->
assertSame
(
[
]
,
$receiver
->
get
(
)
)
;
try
{
$receiver
->
get
(
)
;
}
catch
(
TransportException
$exception
)
{