How to unit test the methods of a class whose constructor take some arguments?
<p>I have a class of form something like this:  </p>

<pre><code>class A{  
    public function __constructor(classB b , classC c){
    //
    }

    public function getSum(var1, var2){
        return var1+var2;
    }
}
</code></pre>

<p>My test case class is something like this:  </p>

<pre><code>use A;   
class ATest extends PHPUnit_Framework_TestCase{  

    public function testGetSum{  
        $a = new A();
        $this-&gt;assertEquals(3, $a-&gt;getSum(1,2));  
    }  
}  
</code></pre>

<p>However when I run the phpunit, it throws some error like:  </p>

<p><code>Missing argument 1 for \..\::__construct(), called in /../A.php on line 5</code>  </p>

<p>Even if I provide the arguments, it throws the same error but in different file.<br>
say, I instantiate by 
<code>$a = new A(new classB(), new classC());</code> </p>

<p>Then, I get the same error for the constructor of classB(the constructor of classB has similar form to that of A).   </p>

<p><code>Missing argument 1 for \..\::__construct(), called in /../B.php on line 10</code>  </p>

<p>Is there any other way, I can test the function or something which I am missing.</p>

<p>I don't want to test by using mock (getMockBuilder(),setMethods(),getMock()) as it seems to defy the whole purpose of unit testing.</p>