Deploy Ladill Transfer / deploy (push) Successful in 33s
Transfer qr_settings only stores notify_email and product_updates. Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\QrSetting;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Illuminate\Support\Str;
|
|
use Tests\TestCase;
|
|
|
|
class QrSettingsTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
Http::preventStrayRequests();
|
|
}
|
|
|
|
private function user(): User
|
|
{
|
|
return User::create(['public_id' => (string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']);
|
|
}
|
|
|
|
public function test_can_save_transfer_settings(): void
|
|
{
|
|
$user = $this->user();
|
|
|
|
$this->actingAs($user)
|
|
->put(route('account.settings.update'), [
|
|
'notify_email' => 'alerts@example.com',
|
|
'product_updates' => '1',
|
|
])
|
|
->assertRedirect(route('account.settings'));
|
|
|
|
$settings = QrSetting::where('user_id', $user->id)->first();
|
|
|
|
$this->assertNotNull($settings);
|
|
$this->assertSame('alerts@example.com', $settings->notify_email);
|
|
$this->assertTrue($settings->product_updates);
|
|
}
|
|
}
|