mirror of
https://github.com/bitinflow/accounts.git
synced 2026-03-13 13:35:52 +00:00
Add create user method
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace GhostZero\BitinflowAccounts\Tests;
|
||||
|
||||
use GhostZero\BitinflowAccounts\Tests\TestCases\ApiTestCase;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @author René Preuß <rene@preuss.io>
|
||||
@@ -18,4 +19,23 @@ class ApiUsersTest extends ApiTestCase
|
||||
$this->registerResult($result = $this->getClient()->getAuthedUser());
|
||||
$this->assertEquals('rene@preuss.io', $result->data()->email);
|
||||
}
|
||||
|
||||
public function testCreateUser(): void
|
||||
{
|
||||
$testEmailAddress = $this->createRandomEmail();
|
||||
|
||||
$this->getClient()->withToken($this->getToken());
|
||||
$this->registerResult($result = $this->getClient()->createUser([
|
||||
'first_name' => 'René',
|
||||
'last_name' => 'Preuß',
|
||||
'email' => $testEmailAddress,
|
||||
'terms_accepted_at' => now()->toDateTimeString(),
|
||||
]));
|
||||
$this->assertEquals($testEmailAddress, $result->data()->email);
|
||||
}
|
||||
|
||||
private function createRandomEmail(): string
|
||||
{
|
||||
return sprintf('rene+unittest.%s@bitinflow.com', Str::random());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user