title: PHPUnit mock method used in another class
body: <p>PHPUnit mock method used in another class?
  Example:</p>
  
  <pre><code>class Main {
    function makePayment() {
      $pp = new PayPalSOAPSomeClass();
      return $pp-&gt;doExpressCheckout();
    }
  }
  </code></pre>
  
  <p>in testing i want test my Main class, and mock doExpressCheckout() method, my not worked code to test:</p>
  
  <pre><code>public function testStub()    {
          $stub = $this-&gt;getMock('PayPalSOAPSomeClass');
          $stub-&gt;expects($this-&gt;any())
               -&gt;method('doExpressCheckout')
               -&gt;will($this-&gt;returnValue(false));
          $pp = new Main;
          $this-&gt;assertEquals(true, $pp-&gt;doExpressCheckout());
      }
  </code></pre>