我希望测试的对象中有以下函数
public function getUser($credentials, UserProviderInterface $userProvider)
{
$resourceOwner = $this->getAuthClient()->fetchUserFromToken($credentials);
// ... Code to create user if non-existent, update values, etc.
// ... Basically the code I want to test is here
return $user;
}
该getAuthClient()调用返回一个Client具有可用功能的对象fetchUserFromToken
我怎样才能在 PHPUnit 测试中模拟fetchUserFromToken返回一个ResourceOwner对象?因为实际函数做了很多认证机制,超出了本测试用例的范围
梦里花落0921