mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 14:36:13 +00:00
update return type for prepare client trait
This commit is contained in:
parent
9641fd3fcc
commit
af24637dc4
@ -17,32 +17,31 @@
|
|||||||
*/
|
*/
|
||||||
namespace Chill\MainBundle\Test;
|
namespace Chill\MainBundle\Test;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare a client authenticated with a user
|
* Prepare a client authenticated with a user
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
*/
|
||||||
trait PrepareClientTrait
|
trait PrepareClientTrait
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new client with authentication information.
|
* Create a new client with authentication information.
|
||||||
*
|
*
|
||||||
* @param string $username the username (default 'center a_social')
|
* @param string $username the username (default 'center a_social')
|
||||||
* @param string $password the password (default 'password')
|
* @param string $password the password (default 'password')
|
||||||
* @return \Symfony\Component\BrowserKit\Client
|
* @return \Symfony\Component\BrowserKit\Client
|
||||||
* @throws \LogicException
|
* @throws \LogicException
|
||||||
*/
|
*/
|
||||||
public function getClientAuthenticated(
|
public function getClientAuthenticated(
|
||||||
$username = 'center a_social',
|
$username = 'center a_social',
|
||||||
$password = 'password'
|
$password = 'password'
|
||||||
) {
|
): KernelBrowser {
|
||||||
if (!$this instanceof WebTestCase) {
|
if (!$this instanceof WebTestCase) {
|
||||||
throw new \LogicException(sprintf("The current class does not "
|
throw new \LogicException(sprintf("The current class does not "
|
||||||
. "implements %s", WebTestCase::class));
|
. "implements %s", WebTestCase::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
return static::createClient(array(), array(
|
return static::createClient(array(), array(
|
||||||
'PHP_AUTH_USER' => $username,
|
'PHP_AUTH_USER' => $username,
|
||||||
'PHP_AUTH_PW' => $password,
|
'PHP_AUTH_PW' => $password,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user