$assert_active_default =
assert_options(ASSERT_ACTIVE
);
// The validator *should* be called when asserts are active.
$validator =
$this->
prophesize(Validator::
class);
$validator->
check(Argument::
any(), Argument::
any())->
shouldBeCalled('Validation should be run when asserts are active.'
);
$validator->
isValid()->
willReturn(TRUE
);
$this->subscriber->
setValidator($validator->
reveal());
// Ensure asset is active.
ini_set('zend.assertions', 1
);
assert_options(ASSERT_ACTIVE, 1
);
$this->subscriber->
doValidateResponse($response,
$request);
// The validator should *not* be called when asserts are inactive.
$validator =
$this->
prophesize(Validator::
class);
$validator->
check(Argument::
any(), Argument::
any())->
shouldNotBeCalled('Validation should not be run when asserts are not active.'
);
$this->subscriber->
setValidator($validator->
reveal());
// Ensure asset is inactive.
ini_set('zend.assertions', 0
);
assert_options(ASSERT_ACTIVE, 0
);
$this->subscriber->
doValidateResponse($response,
$request);