Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/PasswordResetTest.php
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | public function testPasswordResetValidInput() | ||||
$response->assertStatus(200); | $response->assertStatus(200); | ||||
$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($user->email, $json['email']); | $this->assertSame($user->email, $json['email']); | ||||
$this->assertSame($user->id, $json['id']); | $this->assertSame($user->id, $json['id']); | ||||
Queue::assertPushed(\App\Jobs\UserUpdate::class, 1); | Queue::assertPushed(\App\Jobs\User\UpdateJob::class, 1); | ||||
Queue::assertPushed(\App\Jobs\UserUpdate::class, function ($job) use ($user) { | |||||
$job_user = TestCase::getObjectProperty($job, 'user'); | Queue::assertPushed( | ||||
\App\Jobs\User\UpdateJob::class, | |||||
return $job_user->id == $user->id | function ($job) use ($user) { | ||||
&& $job_user->email == $user->email | $userEmail = TestCase::getObjectProperty($job, 'userEmail'); | ||||
&& $job_user->password_ldap != $user->password_ldap; | $userId = TestCase::getObjectProperty($job, 'userId'); | ||||
}); | |||||
return $userEmail == $user->email && $userId == $user->id; | |||||
} | |||||
); | |||||
// Check if the code has been removed | // Check if the code has been removed | ||||
$this->assertNull(VerificationCode::find($code->code)); | $this->assertNull(VerificationCode::find($code->code)); | ||||
// TODO: Check password before and after (?) | // TODO: Check password before and after (?) | ||||
// TODO: Check if the access token works | // TODO: Check if the access token works | ||||
} | } | ||||
} | } |