52 lines
1.3 KiB
Bash
Executable File
52 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
USER_ID=${1:-102}
|
|
|
|
echo "=== Testing All 3 Warning Emails for User ID: $USER_ID ==="
|
|
echo ""
|
|
|
|
# Warning 1: Set inactive_at to 2 minutes ago
|
|
echo "=== Test 1: Warning 1 (inactive for 2 minutes) ==="
|
|
php artisan tinker --execute="
|
|
\$user = App\Models\User::find($USER_ID);
|
|
\$user->inactive_at = now()->subMinutes(2);
|
|
\$user->save();
|
|
echo 'Set inactive_at to 2 minutes ago' . PHP_EOL;
|
|
exit;
|
|
"
|
|
php artisan profiles:process-inactive
|
|
sleep 2
|
|
echo ""
|
|
|
|
# Warning 2: Set inactive_at to 3 minutes ago
|
|
echo "=== Test 2: Warning 2 (inactive for 3 minutes) ==="
|
|
php artisan tinker --execute="
|
|
\$user = App\Models\User::find($USER_ID);
|
|
\$user->inactive_at = now()->subMinutes(3);
|
|
\$user->save();
|
|
echo 'Set inactive_at to 3 minutes ago' . PHP_EOL;
|
|
exit;
|
|
"
|
|
php artisan profiles:process-inactive
|
|
sleep 2
|
|
echo ""
|
|
|
|
# Warning Final: Set inactive_at to 4 minutes ago
|
|
echo "=== Test 3: Warning Final (inactive for 4 minutes) ==="
|
|
php artisan tinker --execute="
|
|
\$user = App\Models\User::find($USER_ID);
|
|
\$user->inactive_at = now()->subMinutes(4);
|
|
\$user->save();
|
|
echo 'Set inactive_at to 4 minutes ago' . PHP_EOL;
|
|
exit;
|
|
"
|
|
php artisan profiles:process-inactive
|
|
sleep 2
|
|
echo ""
|
|
|
|
echo "=== All 3 warning emails sent! ==="
|
|
echo "Processing queue..."
|
|
php artisan queue:work --stop-when-empty --timeout=30
|
|
echo ""
|
|
echo "Check Mailpit for all 3 warning emails sent to user $USER_ID"
|