mmghunaim's avatar

actingAs | be methods

I was wondering whats the difference between $this->be() and $this->ActingAs() ?

Both document as "Set the currently logged in user for the application." in the InteractsWithAuthentication class

0 likes
3 replies
Snapey's avatar
Snapey
Best Answer
Level 122

actingAs just uses be

    public function actingAs(UserContract $user, $driver = null)
    {
        return $this->be($user, $driver);
    }

so there is absolutely no difference. My guess is that it was added to help those with testing experience in another framework?

3 likes
Snapey's avatar

The framework has evolved a lot over the years and there are many things in there that are retained to avoid breaking things.

Maybe it was be() at one time, but feedback was that this was a bad choice of name. Taylor changed it to actingAs() but left the old one there to avoid a breaking change.

2 likes

Please or to participate in this conversation.