LiipFunctionalTestBundle icon indicating copy to clipboard operation
LiipFunctionalTestBundle copied to clipboard

Simplify client instance and loginAs

Open soullivaneuh opened this issue 7 years ago • 2 comments

Currently, if we want to use an another user for auth, we have to do this:

public function testPaymentsAreNotShownOnSearch()
{
    $this->loginAs($this->getReference('user_super_admin'));
    $client = $this->makeClient();
}

Why not make makeClient accepting UserInterface instances? And then we can simplify the call like this:

public function testPaymentsAreNotShownOnSearch()
{
    $client = $this->makeClient($this->getReference('user_super_admin'));
}

And same for fetchContent.

What do you think?

Note: We may also need #345.

soullivaneuh avatar Feb 28 '18 13:02 soullivaneuh

How would this work with custom logins and other custom stuff that the end user may be interested in doing?

Jean85 avatar Feb 28 '18 13:02 Jean85

@Jean85 What do you mean? Do you have an example of what would be problematic?

Note: I don't say to remove the $this->makeClient(true) method, both should be possible.

soullivaneuh avatar Feb 28 '18 13:02 soullivaneuh