yield [Request::
create('/api/login', 'GET',
[],
[],
[],
['HTTP_CONTENT_TYPE' => 'application/json'
]), true
];
yield [Request::
create('/login', 'GET',
[],
[],
[],
['HTTP_CONTENT_TYPE' => 'application/json'
]), false
];
} public function testAuthenticate() { $this->
setUpAuthenticator();
$request =
new Request([],
[],
[],
[],
[],
['HTTP_CONTENT_TYPE' => 'application/json'
], '{"username": "dunglas", "password": "foo"}'
);
$passport =
$this->authenticator->
authenticate($request);
$this->
assertEquals('foo',
$passport->
getBadge(PasswordCredentials::
class)->
getPassword());
} public function testAuthenticateWithCustomPath() { $this->
setUpAuthenticator([ 'username_path' => 'authentication.username',
'password_path' => 'authentication.password',
]);
$request =
new Request([],
[],
[],
[],
[],
['HTTP_CONTENT_TYPE' => 'application/json'
], '{"authentication": {"username": "dunglas", "password": "foo"}}'
);
$passport =
$this->authenticator->
authenticate($request);