Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DeadlineSoonException example
$connection
=
new
Connection
(
[
'tube_name' =>
$tube
, 'timeout' =>
$timeout
]
,
$client
)
;
$this
->
assertNull
(
$connection
->
get
(
)
)
;
}
public
function
testGetWhenABeanstalkdExceptionOccurs
(
)
{
$tube
= 'baz';
$timeout
= 44;
$exception
=
new
DeadlineSoonException
(
'foo error'
)
;
$client
=
$this
->
createMock
(
PheanstalkInterface::
class
)
;
$client
->
expects
(
$this
->
once
(
)
)
->
method
(
'watchOnly'
)
->
with
(
$tube
)
->
willReturn
(
$client
)
;
$client
->
expects
(
$this
->
once
(
)
)
->
method
(
'reserveWithTimeout'
)
->
with
(
$timeout
)
->
willThrowException
(
$exception
)
;
$connection
=
new
Connection
(
[
'tube_name' =>
$tube
, 'timeout' =>
$timeout
]
,
$client
)
;
$this
->
expectExceptionObject
(
new
TransportException
(
$exception
->
getMessage
(
)
, 0,
$exception
)
)
;
$connection
->
get
(
)
;
}