Using Laravel 4.2, I've got a custom class TestyClass
in /app/libraries
.
Using Mockery and PHPUnit, I am attempting to mock this class, but my Mock doesn't seem to register.
When I run the test, I get Mockery\Exception\InvalidCountException: Method testymethod() from Mockery_0_TestyClass should be called exactly 1 times but called 0 times.
My Controller that I am testing runs TestyClass::testymethod();
, and the Log::info inside of testymethod()
runs correctly.
What am I missing to register a Mock of a custom class in Laravel 4.2?
$mock = Mockery::mock('TestyClass');
$mock->shouldReceive('testymethod')->once();
TestyClass:
class TestyClass {
public static function testymethod() {
Log::info('----=-=-=-=--=in heyhey!@!!=-=-=-=-=-=-=-12312312312312341');
return true;
}
}