I'm trying to troubleshoot an issue where in my test, my assert passes.. but neither my expects() passes, nor am I seeing coverage executing in the resulting code coverage generated html.
error: Method was expected to be called 1 times, actually called 0 times.
I'm starting with a very basic example (below). I must be missing something obvious with phpunit that I haven't wrapped my head around with yet, apparently. I double-checked that the function I'm trying to test is in fact a public function.
At this point, I would just like to be able to see some coverage executing in the generated code coverage html.
Any ideas are greatly appreciated.
public function returnVal()
{
return 5;
}
public function test_returnVal()
{
$testVal = 5;
$controllerMock = $this->getMockBuilder('MyClass')
->setMethods(null)
->disableOriginalConstructor()
->getMock();
$controllerMock->expects($this->any())
->method('testReturnVal')
->with($testVal);
$testResult = $controllerMock->testReturnVal($testVal);
$this->assertEquals($testResult, $testVal);
}