Fix unit test

This commit is contained in:
René Preuß
2019-12-11 11:37:48 +01:00
parent f2d064caef
commit 940617af2e
2 changed files with 10 additions and 2 deletions

View File

@@ -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';

View File

@@ -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);
} }