Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/SignupTest.php
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | private function getPublicDomain(): string | ||||
]); | ]); | ||||
} | } | ||||
} | } | ||||
return $this->domain; | return $this->domain; | ||||
} | } | ||||
/** | /** | ||||
* Test fetching public domains for signup | |||||
*/ | |||||
public function testSignupDomains(): void | |||||
{ | |||||
$response = $this->get('/api/auth/signup/domains'); | |||||
$json = $response->json(); | |||||
$response->assertStatus(200); | |||||
$this->assertCount(2, $json); | |||||
$this->assertSame('success', $json['status']); | |||||
$this->assertSame(Domain::getPublicDomains(), $json['domains']); | |||||
} | |||||
/** | |||||
* Test fetching plans for signup | * Test fetching plans for signup | ||||
*/ | */ | ||||
public function testSignupPlans(): void | public function testSignupPlans(): void | ||||
{ | { | ||||
$individual = Plan::withEnvTenantContext()->where('title', 'individual')->first(); | |||||
$group = Plan::withEnvTenantContext()->where('title', 'group')->first(); | |||||
$response = $this->get('/api/auth/signup/plans'); | $response = $this->get('/api/auth/signup/plans'); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$this->assertSame('success', $json['status']); | $this->assertSame('success', $json['status']); | ||||
$this->assertCount(2, $json['plans']); | $this->assertCount(2, $json['plans']); | ||||
$this->assertArrayHasKey('title', $json['plans'][0]); | $this->assertSame($individual->title, $json['plans'][0]['title']); | ||||
$this->assertArrayHasKey('name', $json['plans'][0]); | $this->assertSame($individual->name, $json['plans'][0]['name']); | ||||
$this->assertArrayHasKey('description', $json['plans'][0]); | $this->assertSame($individual->description, $json['plans'][0]['description']); | ||||
$this->assertFalse($json['plans'][0]['isDomain']); | |||||
$this->assertArrayHasKey('button', $json['plans'][0]); | $this->assertArrayHasKey('button', $json['plans'][0]); | ||||
$this->assertSame($group->title, $json['plans'][1]['title']); | |||||
$this->assertSame($group->name, $json['plans'][1]['name']); | |||||
$this->assertSame($group->description, $json['plans'][1]['description']); | |||||
$this->assertTrue($json['plans'][1]['isDomain']); | |||||
$this->assertArrayHasKey('button', $json['plans'][1]); | |||||
} | } | ||||
/** | /** | ||||
* Test fetching invitation | * Test fetching invitation | ||||
*/ | */ | ||||
public function testSignupInvitations(): void | public function testSignupInvitations(): void | ||||
{ | { | ||||
Queue::fake(); | Queue::fake(); | ||||
▲ Show 20 Lines • Show All 870 Lines • Show Last 20 Lines |