Initial commit

This commit is contained in:
Ronald Huynen
2026-03-23 21:37:59 +01:00
commit 2547717edb
2193 changed files with 972171 additions and 0 deletions

View File

@@ -0,0 +1,192 @@
# Artisan Email Testing Command - Summary
## New Artisan Command Created
`php artisan email:send-test` - A comprehensive command for testing all transactional emails in the system.
## Features
### 13 Email Types Supported
1. **Inactive Profile Warnings**
- `inactive-warning-1` - First warning (2 weeks remaining)
- `inactive-warning-2` - Second warning (1 week remaining)
- `inactive-warning-final` - Final warning (24 hours remaining)
2. **Account Management**
- `user-deleted` - User account deleted notification
- `verify-email` - Email verification request
- `profile-link-changed` - Profile name/link changed
- `profile-edited-by-admin` - Admin edited profile notification
3. **Transactions**
- `transfer-received` - Payment/transfer received notification
4. **Reservations**
- `reservation-created` - New reservation created
- `reservation-cancelled` - Reservation cancelled
- `reservation-updated` - Reservation updated
5. **Social**
- `reaction-created` - New comment/reaction on post
- `tag-added` - Tag added to profile
### Multiple Receiver Types
- `user` - Individual user profiles
- `organization` - Organization profiles
- `admin` - Admin profiles
- `bank` - Bank profiles
### Command Modes
**1. Direct Command**
```bash
php artisan email:send-test --type=inactive-warning-1 --receiver=user --id=102
```
**2. Interactive Mode**
```bash
php artisan email:send-test
# Presents menu to select email type, receiver type, and ID
```
**3. List Mode**
```bash
php artisan email:send-test --list
# Shows all available email types with descriptions
```
**4. Queue Mode**
```bash
php artisan email:send-test --type=transfer-received --receiver=user --id=102 --queue
# Sends via queue instead of immediately
```
## Quick Start Examples
### Send a Single Email
```bash
php artisan email:send-test --type=inactive-warning-1 --receiver=user --id=102
```
### Test All Warning Emails
```bash
./test-warning-emails.sh 102
```
Or manually:
```bash
php artisan email:send-test --type=inactive-warning-1 --receiver=user --id=102
php artisan email:send-test --type=inactive-warning-2 --receiver=user --id=102
php artisan email:send-test --type=inactive-warning-final --receiver=user --id=102
```
### List All Available Emails
```bash
php artisan email:send-test --list
```
### Interactive Mode
```bash
php artisan email:send-test
# Follow the prompts
```
## Test Data Generation
The command automatically generates realistic test data for each email type:
- **Account balances**: Uses actual account data from the receiver's profile
- **Time remaining**: Realistic values based on email type
- **Transaction amounts**: Sample formatted amounts
- **Dates**: Future dates for reservations
- **Names/URLs**: Generated test data with proper formatting
## Files Created
1. **`app/Console/Commands/SendTestEmail.php`** - Main artisan command
2. **`EMAIL-TESTING-GUIDE.md`** - Comprehensive usage guide
3. **`test-warning-emails.sh`** - Quick script to test all 3 warning emails
4. **`ARTISAN-EMAIL-COMMAND-SUMMARY.md`** - This summary
## Advantages Over Tinker Script
1. **Type Safety**: Validates email types and receiver types before sending
2. **Error Handling**: Clear error messages for invalid inputs
3. **User-Friendly**: Interactive mode for easy selection
4. **Comprehensive**: Supports 13 different email types
5. **Flexible**: Multiple receiver types (user, organization, admin, bank)
6. **Queue Support**: Option to send via queue
7. **List View**: Easy discovery of all available email types
8. **Professional CLI**: Proper command structure and help text
## Migration from Tinker Script
### Old Way (Tinker)
```bash
php artisan tinker --execute="include 'send-test-warnings.php'; sendTestWarnings(102);"
```
### New Way (Artisan Command)
```bash
# Single email
php artisan email:send-test --type=inactive-warning-1 --receiver=user --id=102
# All warnings
./test-warning-emails.sh 102
# Or interactive
php artisan email:send-test
```
## Next Steps
1. **Test all email types** - Verify each email renders correctly
2. **Test different receivers** - Try with user, organization profiles
3. **Test themes** - Send emails with different `TIMEBANK_THEME` values
4. **Test languages** - Verify emails in all supported languages (en, nl, de, es, fr)
5. **Review email content** - Approve English text for translation
6. **Create translation keys** - Add approved text to language files
## Usage Tips
1. **Find User IDs**:
```bash
php artisan tinker --execute="echo App\Models\User::where('email', 'user@example.com')->first()->id;"
```
2. **Test Theme Colors**:
```bash
TIMEBANK_THEME=uuro php artisan email:send-test --type=inactive-warning-1 --receiver=user --id=102
```
3. **Test Language**:
```bash
# Change user's language first
php artisan tinker --execute="\$u = App\Models\User::find(102); \$u->lang_preference = 'nl'; \$u->save();"
# Then send email
php artisan email:send-test --type=inactive-warning-1 --receiver=user --id=102
```
4. **Batch Testing**:
```bash
# Queue multiple emails
php artisan email:send-test --type=inactive-warning-1 --receiver=user --id=102 --queue
php artisan email:send-test --type=inactive-warning-2 --receiver=user --id=102 --queue
php artisan email:send-test --type=inactive-warning-final --receiver=user --id=102 --queue
# Process queue
php artisan queue:work --stop-when-empty
```
## Documentation
See **EMAIL-TESTING-GUIDE.md** for comprehensive documentation including:
- All available email types
- Command options
- Usage examples
- Troubleshooting guide
- Theme and language testing
- Batch testing scripts