title: Is it possible to mock the non-existence of a function in PHPUnit?
body: <p>I have a unit test that checks that an exception is thrown if the <code>openssl_random_pseudo_bytes</code> is not installed. However, if it <em>is</em> 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. </p>
  
  <p>Does anyone have any ideas?</p>
  
  <p>Here is my test as it stands:</p>
  
  <pre><code>public function testGenerateOpenSSLThrowsExceptionWhenFunctionDoesNotExist()
  {
      if (function_exists('openssl_random_pseudo_bytes')) {
          $this-&gt;markTestSkipped('Cannot run test: openssl_random_pseudo_bytes function exists.');
      }
  
      $this-&gt;_salt-&gt;generateFromOpenSSL();
  }
  </code></pre>