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