But I'm explicitly expecting a warning here. My test covers this through error_get_last as a workaround; however, it would be nice to simply:
it('emits a warning', function() {
trigger_error('warn', E_USER_WARNING);
})->expectWarningMessage('warn');
Similar to how exceptions can be checked.
I'd prefer to throw an exception in my library; however, that would be disastrous since nothing would break unless the library is used in a particular way. So, a warning is emitted so that the developer can either ignore it or choose to throw an exception if it effects them.
I see a nice yellow WARN:
But I'm explicitly expecting a warning here. My test covers this through
error_get_last
as a workaround; however, it would be nice to simply:Similar to how exceptions can be checked.
I'd prefer to throw an exception in my library; however, that would be disastrous since nothing would break unless the library is used in a particular way. So, a warning is emitted so that the developer can either ignore it or choose to throw an exception if it effects them.