mirror of
https://github.com/bitinflow/accounts.git
synced 2026-03-13 13:35:52 +00:00
Fix unit test
This commit is contained in:
@@ -30,6 +30,8 @@ class Scope
|
|||||||
// Manage a authorized user object.
|
// Manage a authorized user object.
|
||||||
public const USERS_EDIT = 'users:edit';
|
public const USERS_EDIT = 'users:edit';
|
||||||
|
|
||||||
|
public const USERS_CREATE = 'users:create';
|
||||||
|
|
||||||
// Read authorized user´s transactions.
|
// Read authorized user´s transactions.
|
||||||
public const TRANSACTIONS_READ = 'transactions:read';
|
public const TRANSACTIONS_READ = 'transactions:read';
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace GhostZero\BitinflowAccounts\Tests;
|
namespace GhostZero\BitinflowAccounts\Tests;
|
||||||
|
|
||||||
|
use GhostZero\BitinflowAccounts\Enums\Scope;
|
||||||
use GhostZero\BitinflowAccounts\Tests\TestCases\ApiTestCase;
|
use GhostZero\BitinflowAccounts\Tests\TestCases\ApiTestCase;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@@ -25,15 +26,20 @@ class ApiUsersTest extends ApiTestCase
|
|||||||
{
|
{
|
||||||
$testEmailAddress = $this->createRandomEmail();
|
$testEmailAddress = $this->createRandomEmail();
|
||||||
|
|
||||||
$this->getClient()->withToken($this->getToken());
|
$this->registerResult($result = $this->getClient()->retrievingToken('client_credentials', [
|
||||||
|
'scope' => Scope::USERS_CREATE,
|
||||||
|
]));
|
||||||
|
|
||||||
|
$this->getClient()->withToken($result->data()->access_token);
|
||||||
$this->registerResult($result = $this->getClient()->createUser([
|
$this->registerResult($result = $this->getClient()->createUser([
|
||||||
'first_name' => 'René',
|
'first_name' => 'René',
|
||||||
'last_name' => 'Preuß',
|
'last_name' => 'Preuß',
|
||||||
'email' => $testEmailAddress,
|
'email' => $testEmailAddress,
|
||||||
'password' => 'Password1',
|
'password' => 'Password1',
|
||||||
'password_confirmation' => 'Password1',
|
'password_confirmation' => 'Password1',
|
||||||
'tos' => true,
|
'terms_accepted' => true,
|
||||||
]));
|
]));
|
||||||
|
$this->assertTrue($result->success(), $result->error());
|
||||||
$this->assertEquals($testEmailAddress, $result->data()->email);
|
$this->assertEquals($testEmailAddress, $result->data()->email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user