From 940617af2e8cc62d059520d124634388748ad270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Preu=C3=9F?= Date: Wed, 11 Dec 2019 11:37:48 +0100 Subject: [PATCH] Fix unit test --- src/GhostZero/BitinflowAccounts/Enums/Scope.php | 2 ++ tests/GhostZero/BitinflowAccounts/ApiUsersTest.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/GhostZero/BitinflowAccounts/Enums/Scope.php b/src/GhostZero/BitinflowAccounts/Enums/Scope.php index 1e69375..1605ff0 100644 --- a/src/GhostZero/BitinflowAccounts/Enums/Scope.php +++ b/src/GhostZero/BitinflowAccounts/Enums/Scope.php @@ -30,6 +30,8 @@ class Scope // Manage a authorized user object. public const USERS_EDIT = 'users:edit'; + public const USERS_CREATE = 'users:create'; + // Read authorized user´s transactions. public const TRANSACTIONS_READ = 'transactions:read'; diff --git a/tests/GhostZero/BitinflowAccounts/ApiUsersTest.php b/tests/GhostZero/BitinflowAccounts/ApiUsersTest.php index 865fa50..7d42284 100644 --- a/tests/GhostZero/BitinflowAccounts/ApiUsersTest.php +++ b/tests/GhostZero/BitinflowAccounts/ApiUsersTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace GhostZero\BitinflowAccounts\Tests; +use GhostZero\BitinflowAccounts\Enums\Scope; use GhostZero\BitinflowAccounts\Tests\TestCases\ApiTestCase; use Illuminate\Support\Str; @@ -25,15 +26,20 @@ class ApiUsersTest extends ApiTestCase { $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([ 'first_name' => 'René', 'last_name' => 'Preuß', 'email' => $testEmailAddress, 'password' => 'Password1', 'password_confirmation' => 'Password1', - 'tos' => true, + 'terms_accepted' => true, ])); + $this->assertTrue($result->success(), $result->error()); $this->assertEquals($testEmailAddress, $result->data()->email); }