title: Testing static classes with PHPUnit
body: <p>I've got a set of classes I'm trying to test. Class A depends on Class X. Class X contains functions which do random things and things with databases. I've created a mock version of Class X  which returns exactly what I want it to in order to test Class A without dependencies.</p>
  
  <p>So, my question is, how do I now test Class X as I've already included the mock version, which has the same name and filename. I get the "Cannot redeclare Class X" error.</p>
  
  <p>I don't think I can use stubs as there's no way to pass the stubbed object into my class under test. The class under test (Class A) will ask for an instance of a static class (ClassA::getInstance();).</p>
  
  <p>Is this going to be something to do with test suites or test cases as I can't un-include a the file which contains the mock version of Class X.</p>
  
  <p>Thanks in advance for your help,</p>
  
  <p>Mike</p>