2016-09-01 13:01:43 +05:30
|
|
|
<?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 {
|
|
|
|
|
2017-01-24 04:30:08 +05:30
|
|
|
public function amAuthenticated(string $asUsername = 'admin', string $password = 'password_0') {
|
2016-09-01 13:01:43 +05:30
|
|
|
$route = new AuthserverRoute($this);
|
|
|
|
$clientToken = Uuid::uuid4()->toString();
|
|
|
|
$route->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];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|