2016-09-01 10:31:43 +03:00
|
|
|
<?php
|
2019-02-20 22:58:52 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace api\tests\functional\_steps;
|
2016-09-01 10:31:43 +03:00
|
|
|
|
2019-02-20 22:58:52 +03:00
|
|
|
use api\tests\FunctionalTester;
|
2019-02-23 02:11:57 +03:00
|
|
|
use Ramsey\Uuid\Uuid;
|
2016-09-01 10:31:43 +03:00
|
|
|
|
|
|
|
class AuthserverSteps extends FunctionalTester {
|
|
|
|
|
2019-12-04 21:10:15 +03:00
|
|
|
public function amAuthenticated(string $asUsername = 'admin', string $password = 'password_0'): array {
|
2016-09-01 10:31:43 +03:00
|
|
|
$clientToken = Uuid::uuid4()->toString();
|
2019-12-04 21:10:15 +03:00
|
|
|
$this->sendPOST('/api/authserver/authentication/authenticate', [
|
2017-01-24 02:00:08 +03:00
|
|
|
'username' => $asUsername,
|
|
|
|
'password' => $password,
|
2016-09-01 10:31:43 +03:00
|
|
|
'clientToken' => $clientToken,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$accessToken = $this->grabDataFromResponseByJsonPath('$.accessToken')[0];
|
|
|
|
|
|
|
|
return [$accessToken, $clientToken];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|