function expect_Curl_jsonRequest() { $curl = m::mock('Hypercharge\\Curl[jsonRequest][close]', array(Config::getUser(), Config::getPassword())); $curl->shouldReceive('close'); $factory = m::mock('Hypercharge\\Factory[createHttpsClient]'); $factory->shouldReceive('createHttpsClient')->andReturn($curl); Config::setFactory($factory); return $curl->shouldReceive('jsonRequest'); }