public function testCallStatic() { $factory = m::mock('Omnipay\\Common\\GatewayFactory'); $factory->shouldReceive('testMethod')->with('some-argument')->once()->andReturn('some-result'); Omnipay::setFactory($factory); $result = Omnipay::testMethod('some-argument'); $this->assertSame('some-result', $result); }