I have a unit test that checks that an exception is thrown if the openssl_random_pseudo_bytes
is not installed. However, if it is installed, it currently gets skipped. This is unsatisfactory to me, though, as it results in an imperfect test run. I could set the unit test to pass, but that feels like a cheat.
Does anyone have any ideas?
Here is my test as it stands:
public function testGenerateOpenSSLThrowsExceptionWhenFunctionDoesNotExist()
{
if (function_exists('openssl_random_pseudo_bytes')) {
$this->markTestSkipped('Cannot run test: openssl_random_pseudo_bytes function exists.');
}
$this->_salt->generateFromOpenSSL();
}