accounts/api/tests/functional/_steps/AuthserverSteps.php

25 lines
677 B
PHP
Raw Normal View History

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