title: PHPUnit getMock() with namespace
body: <p>My quest of starting to use namespaces in PHP keeps continuing. This time PHPUnit gives me problems. My setup() method is like this:</p>
  
  <pre><code>$test = new \MyNamespace\NonPersistentStorage(); // works
  $mock = $this-&gt;getMock('\\MyNamespace\\NonPersistentStorage'); // doesn't work
  </code></pre>
  
  <p>The getMock() method only results in PHP looking for a NonPersistentStorage class. Not within the namespace.</p>
  
  <p>Q: What do I need to change to get the getMock() method look for the class in the namespace?</p>
  
  <p>Edit: The double backslash is not the problem. Also see: <a href="http://us2.php.net/manual/en/language.namespaces.faq.php#language.namespaces.faq.quote" rel="noreferrer">the manual</a>: (quote)</p>
  
  <p>'Inside a single-quoted string, the backslash escape sequence is much safer to use, but it is still recommended practice to escape backslashes in all strings as a best practice.'</p>
  
  <p>edit: What worked for me is in the comments of the answer of Ignace R.</p>