Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/SignupTest.php
Show First 20 Lines • Show All 469 Lines • ▼ Show 20 Lines | public function testSignupValidInput(array $result) | ||||
'short_code' => $code->short_code, | 'short_code' => $code->short_code, | ||||
'voucher' => 'TEST', | 'voucher' => 'TEST', | ||||
]; | ]; | ||||
$response = $this->post('/api/auth/signup', $data); | $response = $this->post('/api/auth/signup', $data); | ||||
$json = $response->json(); | $json = $response->json(); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$this->assertCount(4, $json); | |||||
$this->assertSame('success', $json['status']); | $this->assertSame('success', $json['status']); | ||||
$this->assertSame('bearer', $json['token_type']); | $this->assertSame('bearer', $json['token_type']); | ||||
$this->assertTrue(!empty($json['expires_in']) && is_int($json['expires_in']) && $json['expires_in'] > 0); | $this->assertTrue(!empty($json['expires_in']) && is_int($json['expires_in']) && $json['expires_in'] > 0); | ||||
$this->assertNotEmpty($json['access_token']); | $this->assertNotEmpty($json['access_token']); | ||||
$this->assertSame($identity, $json['email']); | |||||
Queue::assertPushed(\App\Jobs\UserCreate::class, 1); | Queue::assertPushed(\App\Jobs\UserCreate::class, 1); | ||||
Queue::assertPushed(\App\Jobs\UserCreate::class, function ($job) use ($data) { | Queue::assertPushed(\App\Jobs\UserCreate::class, function ($job) use ($data) { | ||||
$job_user = TestCase::getObjectProperty($job, 'user'); | $job_user = TestCase::getObjectProperty($job, 'user'); | ||||
return $job_user->email === \strtolower($data['login'] . '@' . $data['domain']); | return $job_user->email === \strtolower($data['login'] . '@' . $data['domain']); | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | public function testSignupGroupAccount() | ||||
'code' => $code->code, | 'code' => $code->code, | ||||
'short_code' => $code->short_code, | 'short_code' => $code->short_code, | ||||
]; | ]; | ||||
$response = $this->post('/api/auth/signup', $data); | $response = $this->post('/api/auth/signup', $data); | ||||
$result = $response->json(); | $result = $response->json(); | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$this->assertCount(4, $result); | |||||
$this->assertSame('success', $result['status']); | $this->assertSame('success', $result['status']); | ||||
$this->assertSame('bearer', $result['token_type']); | $this->assertSame('bearer', $result['token_type']); | ||||
$this->assertTrue(!empty($result['expires_in']) && is_int($result['expires_in']) && $result['expires_in'] > 0); | $this->assertTrue(!empty($result['expires_in']) && is_int($result['expires_in']) && $result['expires_in'] > 0); | ||||
$this->assertNotEmpty($result['access_token']); | $this->assertNotEmpty($result['access_token']); | ||||
$this->assertSame("$login@$domain", $result['email']); | |||||
Queue::assertPushed(\App\Jobs\DomainCreate::class, 1); | Queue::assertPushed(\App\Jobs\DomainCreate::class, 1); | ||||
Queue::assertPushed(\App\Jobs\DomainCreate::class, function ($job) use ($domain) { | Queue::assertPushed(\App\Jobs\DomainCreate::class, function ($job) use ($domain) { | ||||
$job_domain = TestCase::getObjectProperty($job, 'domain'); | $job_domain = TestCase::getObjectProperty($job, 'domain'); | ||||
return $job_domain->namespace === $domain; | return $job_domain->namespace === $domain; | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |