Extract Ladill Servers as standalone app at servers.ladill.com.
VPS and dedicated server ordering, managed panels, SSO, billing, and launcher integration — forked from hosting infrastructure with server-focused routes and dashboard. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\EmailTeamMember;
|
||||
use App\Models\User;
|
||||
use App\Services\Billing\BillingClient;
|
||||
use App\Services\Payment\WalletPaymentService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Str;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AccountPagesTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
Mockery::close();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
private function user(): User
|
||||
{
|
||||
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
|
||||
}
|
||||
|
||||
public function test_settings_page_renders(): void
|
||||
{
|
||||
$this->actingAs($this->user())->get(route('account.settings'))->assertOk()->assertSee('Hosting notifications');
|
||||
}
|
||||
|
||||
public function test_team_page_renders_with_owner(): void
|
||||
{
|
||||
$u = $this->user();
|
||||
$this->actingAs($u)->get(route('account.team'))->assertOk()->assertSee('Owner')->assertSee($u->email);
|
||||
}
|
||||
|
||||
public function test_team_invite_creates_member(): void
|
||||
{
|
||||
$u = $this->user();
|
||||
$this->actingAs($u)->post(route('account.team.store'), ['email' => 'mate@x.com', 'role' => 'member'])
|
||||
->assertRedirect();
|
||||
$this->assertDatabaseHas('email_team_members', ['account_id' => $u->id, 'email' => 'mate@x.com', 'status' => 'invited']);
|
||||
}
|
||||
|
||||
public function test_developers_page_and_token_lifecycle(): void
|
||||
{
|
||||
$u = $this->user();
|
||||
$this->actingAs($u)->get(route('account.developers'))->assertOk()->assertSee('Create a token');
|
||||
$this->actingAs($u)->post(route('account.developers.store'), ['name' => 'CI'])
|
||||
->assertRedirect()->assertSessionHas('new_token');
|
||||
$this->assertSame(1, $u->tokens()->count());
|
||||
}
|
||||
|
||||
public function test_billing_page_renders(): void
|
||||
{
|
||||
$w = Mockery::mock(WalletPaymentService::class);
|
||||
$w->shouldReceive('balanceMinor')->andReturn(5000);
|
||||
$this->app->instance(WalletPaymentService::class, $w);
|
||||
|
||||
$b = Mockery::mock(BillingClient::class);
|
||||
$b->shouldReceive('serviceLedger')->andReturn(['spent_minor' => 1000, 'credited_minor' => 0]);
|
||||
$b->shouldReceive('balanceMinor')->andReturn(5000);
|
||||
$this->app->instance(BillingClient::class, $b);
|
||||
|
||||
$this->actingAs($this->user())->get(route('account.billing'))
|
||||
->assertOk()->assertSee('Spent on hosting');
|
||||
}
|
||||
|
||||
public function test_switch_account_rejects_inaccessible(): void
|
||||
{
|
||||
$this->actingAs($this->user())->post(route('account.switch'), ['account' => 999999])->assertForbidden();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user