Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
delayFor example
use
PHPUnit\Framework\TestCase;
use
Symfony\Component\Messenger\Stamp\DelayStamp;
/** * @author Yanick Witschi <
[email protected]
> */
class
DelayStampTest
extends
TestCase
{
public
function
testDelayFor
(
)
{
$stamp
= DelayStamp::
delayFor
(
\DateInterval::
createFromDateString
(
'30 seconds'
)
)
;
$this
->
assertSame
(
30000,
$stamp
->
getDelay
(
)
)
;
$stamp
= DelayStamp::
delayFor
(
\DateInterval::
createFromDateString
(
'30 minutes'
)
)
;
$this
->
assertSame
(
1800000,
$stamp
->
getDelay
(
)
)
;
$stamp
= DelayStamp::
delayFor
(
\DateInterval::
createFromDateString
(
'30 hours'
)
)
;
$this
->
assertSame
(
108000000,
$stamp
->
getDelay
(
)
)
;
$stamp
= DelayStamp::
delayFor
(
\DateInterval::
createFromDateString
(
'-5 seconds'
)
)
;
$this
->
assertSame
(
-5000,
$stamp
->
getDelay
(
)
)
;
}
public
function
testDelayUntil
(
)
{