mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Rework tests structure. Upgrade codeception to 2.5.3. Merge params configuration into app configuration.
This commit is contained in:
26
api/tests/functional/_steps/AuthserverSteps.php
Normal file
26
api/tests/functional/_steps/AuthserverSteps.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace api\tests\functional\_steps;
|
||||
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use api\tests\_pages\AuthserverRoute;
|
||||
use api\tests\FunctionalTester;
|
||||
|
||||
class AuthserverSteps extends FunctionalTester {
|
||||
|
||||
public function amAuthenticated(string $asUsername = 'admin', string $password = 'password_0'): array {
|
||||
$route = new AuthserverRoute($this);
|
||||
$clientToken = Uuid::uuid4()->toString();
|
||||
$route->authenticate([
|
||||
'username' => $asUsername,
|
||||
'password' => $password,
|
||||
'clientToken' => $clientToken,
|
||||
]);
|
||||
|
||||
$accessToken = $this->grabDataFromResponseByJsonPath('$.accessToken')[0];
|
||||
|
||||
return [$accessToken, $clientToken];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user