title: Unit test for mocking a method called by new class object
body: <p>I am writing unit test for an existing code which is like this</p>
  
  <pre><code>class someClass {
      public function __construct() { ... }
  
      public function someFoo($var) {
          ...
          $var = "something";
          ...
          $model = new someClass();
          model-&gt;someOtherFoo($var);
      }
  
      public someOtherFoo($var){
           // some code which has to be mocked
      }
  }
  </code></pre>
  
  <p>Here how should I be able to mock the call to function "<code>someOtherFoo</code>" such that it doesn't execute "<code>some code</code>" inside <code>someOtherFoo</code>?</p>
  
  <pre><code>class someClassTest {
     public function someFoo() {
        $fixture = $this-&gt;getMock('someClass ', array('someOtherFoo'));
        $var = "something";
        ....
        // How to mock the call to someOtherFoo() here
     }
  
  }
  </code></pre>
  
  <p>Is it possible to mock out the constructor so that it returns my own constructed function or variable?</p>
  
  <p>Thanks</p>