liip / liip/LiipFunctionalTestBundle

Simplify client instance and loginAs

Open
#401 2 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
PHP
Stars
648
Forks
179
PR merge metrics
No merged PRs in 30d

Description

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

```php
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:

```php
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing makeClient, fetchContent, and loginAs helpers and review how #345 affects them. Update the helpers to accept UserInterface instances so authentication can be supplied directly, then verify the functional test usage no longer requires a separate loginAs call.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.