title: PHPUnit Singleton - Test one method and stub other
body: <p>I'm extremely new at phpunit...<br />
  I have a singleton named <code>MyClass</code> like this:</p>
  <pre><code>class MyClass extends CoreSingleton {
      
      function methodA($paramA) {
          // do something with $paramA
          return $result;
      }
  
      function methodB($paramB) {
          // do something with $paramB
          // do something with methodA()
          return $result;
      }
  }
  </code></pre>
  <p>I want to test <code>methodB()</code> macking a stub of <code>methodA()</code></p>
  <pre><code>class MyClassUnitTest extends TestCase {
  
      private $subject;
      private $data = 'something';
  
      function setUp() {
          parent::setUp();
          $this-&gt;subject = MyClass::getInstance();
          
      }
  
      function testMethodB() {
          $expected = 'bla bla bla';
          $result = $this-&gt;subject-&gt;methodB($this-&gt;data);
          // HERE this &quot;works&quot; but I need to stub methodA()
          $this-&gt;assertEquals($result, $expected);
      }
  
  }
  </code></pre>
  <p>Before the <code>assertEquals()</code> I need something like <code>$this-&gt;subject-&gt;method('methodA')-&gt;willReturn('hi!');</code></p>