This commit is contained in:
2026-10-03 14:33:08 +04:00
parent 6a73d760c4
commit 93a9442e1c
67 changed files with 941 additions and 698 deletions
+11 -4
View File
@@ -4,7 +4,7 @@ namespace Tests\Feature;
use App\Exceptions\DuplicateGameAccountException;
use App\Exceptions\InviteCodeException;
use App\Services\AzerothCoreAccountRegistrar;
use App\Services\VMangosAccountRegistrar;
use App\Services\InviteCodeService;
use Closure;
use Mockery\MockInterface;
@@ -12,6 +12,13 @@ use Tests\TestCase;
class GameAccountRegistrationTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
config(['moonwell.registration.require_invite_code' => true]);
}
public function test_registration_form_submits_successfully(): void
{
$this->mock(InviteCodeService::class, function (MockInterface $mock): void {
@@ -21,7 +28,7 @@ class GameAccountRegistrationTest extends TestCase
->andReturnUsing(fn (string $code, string $username, Closure $callback): array => $callback());
});
$this->mock(AzerothCoreAccountRegistrar::class, function (MockInterface $mock): void {
$this->mock(VMangosAccountRegistrar::class, function (MockInterface $mock): void {
$mock->shouldReceive('register')
->once()
->with('playerone', 'player@example.com', 'Pass1234')
@@ -63,7 +70,7 @@ class GameAccountRegistrationTest extends TestCase
$this->mock(InviteCodeService::class, function (MockInterface $mock): void {
$mock->shouldNotReceive('redeemForRegistration');
});
$this->mock(AzerothCoreAccountRegistrar::class, function (MockInterface $mock): void {
$this->mock(VMangosAccountRegistrar::class, function (MockInterface $mock): void {
$mock->shouldReceive('register')
->once()
->with('playerone', 'player@example.com', 'Pass1234')
@@ -87,7 +94,7 @@ class GameAccountRegistrationTest extends TestCase
->andReturnUsing(fn (string $code, string $username, Closure $callback): array => $callback());
});
$this->mock(AzerothCoreAccountRegistrar::class, function (MockInterface $mock): void {
$this->mock(VMangosAccountRegistrar::class, function (MockInterface $mock): void {
$mock->shouldReceive('register')
->once()
->andThrow(DuplicateGameAccountException::forUsername());