mirror of
https://github.com/elyby/accounts.git
synced 2024-12-15 09:59:00 +05:30
25 lines
721 B
PHP
25 lines
721 B
PHP
<?php
|
|
namespace tests\codeception\api\functional\_steps;
|
|
|
|
use Ramsey\Uuid\Uuid;
|
|
use tests\codeception\api\_pages\AuthserverRoute;
|
|
use tests\codeception\api\FunctionalTester;
|
|
|
|
class AuthserverSteps extends FunctionalTester {
|
|
|
|
public function amAuthenticated(string $asUsername = 'admin', string $password = 'password_0') {
|
|
$route = new AuthserverRoute($this);
|
|
$clientToken = Uuid::uuid4()->toString();
|
|
$route->authenticate([
|
|
'username' => $asUsername,
|
|
'password' => $password,
|
|
'clientToken' => $clientToken,
|
|
]);
|
|
|
|
$accessToken = $this->grabDataFromResponseByJsonPath('$.accessToken')[0];
|
|
|
|
return [$accessToken, $clientToken];
|
|
}
|
|
|
|
}
|