mirror of
https://gh.wpcy.net/https://github.com/aspirepress/AspireCloud.git
synced 2026-07-17 11:37:03 +08:00
* fix: rm last vestiges of SyncPlugin * refactor: move Sanctum tests into their own dir * tests: zap example tests * test: break helpers out into the tests/Helpers dir * build: composer bump * refactor: rm unused TranslationData class * build: run composer update since bump does not (WTF) * refactor: move docker app from /var/www/html to /app this is the de facto standard for docker apps, and it makes config much simpler if we follow it * build: upgrade dockerfiles to composer 2.8 * build: tweak composer invocation for prod * tests: rm placeholder that never got filled out * tests: write tests for sync themes/plugins * tests: put back dummy unit test because pest freaks out w/ an empty dir * tests: rm copypasta from SyncThemeTest * build: bump after update, silly, not before
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
test('password can be updated', function () {
|
|
$this->actingAs($user = User::factory()->create());
|
|
|
|
$this->put('/user/password', [
|
|
'current_password' => 'password',
|
|
'password' => 'new-password',
|
|
'password_confirmation' => 'new-password',
|
|
]);
|
|
|
|
expect(Hash::check('new-password', $user->fresh()->password))->toBeTrue();
|
|
});
|
|
|
|
test('current password must be correct', function () {
|
|
$this->actingAs($user = User::factory()->create());
|
|
|
|
$response = $this->put('/user/password', [
|
|
'current_password' => 'wrong-password',
|
|
'password' => 'new-password',
|
|
'password_confirmation' => 'new-password',
|
|
]);
|
|
|
|
$response->assertSessionHasErrors();
|
|
|
|
expect(Hash::check('password', $user->fresh()->password))->toBeTrue();
|
|
});
|
|
|
|
test('new passwords must match', function () {
|
|
$this->actingAs($user = User::factory()->create());
|
|
|
|
$response = $this->put('/user/password', [
|
|
'current_password' => 'password',
|
|
'password' => 'new-password',
|
|
'password_confirmation' => 'wrong-password',
|
|
]);
|
|
|
|
$response->assertSessionHasErrors();
|
|
|
|
expect(Hash::check('password', $user->fresh()->password))->toBeTrue();
|
|
});
|