Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
tolerates example
$currErrorHandler
=
set_error_handler
(
'is_int'
)
;
restore_error_handler
(
)
;
if
(
$currErrorHandler
!==
[
$this
, 'handleError'
]
)
{
echo
"\n", self::
colorize
(
'THE ERROR HANDLER HAS CHANGED!', true
)
, "\n";
}
$groups
=
array_keys
(
$this
->deprecationGroups
)
;
// store failing status
$isFailing
= !
$configuration
->
tolerates
(
$this
->deprecationGroups
)
;
$this
->
displayDeprecations
(
$groups
,
$configuration
)
;
$this
->
resetDeprecationGroups
(
)
;
register_shutdown_function
(
function
D
)
use
(
$isFailing
,
$groups
,
$configuration
)
{
foreach
(
$this
->deprecationGroups
as
$group
)
{
if
(
$group
->
count
(
)
> 0
)
{
echo
"Shutdown-time deprecations:\n";
break
;
}
}
public
function
testItThrowsOnStringishThreshold
(
)
{
$this
->
expectException
(
\InvalidArgumentException::
class
)
;
$this
->
expectExceptionMessage
(
'forty-two'
)
;
Configuration::
fromUrlEncodedString
(
'max[total]=forty-two'
)
;
}
public
function
testItNoticesExceededTotalThreshold
(
)
{
$configuration
= Configuration::
fromUrlEncodedString
(
'max[total]=3'
)
;
$this
->
assertTrue
(
$configuration
->
tolerates
(
$this
->
buildGroups
(
[
'unsilenced' => 1,
'self' => 0,
'legacy' => 1,
'other' => 0,
'direct' => 1,
'indirect' => 1,
]
)
)
)
;
$this
->
assertFalse
(
$configuration
->
tolerates
(
$this
->
buildGroups
(
[
'unsilenced' => 1,
'self' => 1,
'legacy' => 1,