Commit 56cb4395 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Add seed: 32 bot players + test tournament for bracket testing

Run: php cli.php seed:run Phase_88_001_seed_tournament_bot_players
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 0f4ca990
<?php
declare(strict_types=1);
/**
* Seed: Generate 32 bot players and register them in a test tournament.
* Run: php cli.php seed:run Phase_88_001_seed_tournament_bot_players
*/
return function (\App\Core\Database $db) {
$ts = date('Y-m-d H:i:s');
$firstNames = [
'أحمد', 'محمد', 'عمر', 'يوسف', 'علي', 'حسن', 'خالد', 'إبراهيم',
'مصطفى', 'كريم', 'طارق', 'سامي', 'ياسر', 'هشام', 'وليد', 'رامي',
'زياد', 'فادي', 'باسم', 'شريف', 'عادل', 'ماجد', 'سعيد', 'نبيل',
'حازم', 'تامر', 'عمرو', 'أسامة', 'جمال', 'منير', 'أيمن', 'بلال',
];
$lastNames = [
'السيد', 'محمود', 'إبراهيم', 'حسين', 'عبدالله', 'عبدالرحمن', 'الشريف', 'المصري',
'العربي', 'الجوهري', 'الفقي', 'النجار', 'الحداد', 'البنا', 'الغامدي', 'صالح',
'العزيز', 'الرشيدي', 'الكبير', 'المنصور', 'الأمين', 'الحكيم', 'السعيد', 'الطيب',
'المختار', 'العادل', 'الهادي', 'الكريم', 'الرازق', 'البدري', 'الصافي', 'النور',
];
$playerIds = [];
// Generate 32 bot players
for ($i = 0; $i < 32; $i++) {
$firstName = $firstNames[$i];
$lastName = $lastNames[$i];
$fullName = $firstName . ' ' . $lastName;
// Generate random DOB (age 15-35)
$age = rand(15, 35);
$year = date('Y') - $age;
$month = str_pad((string) rand(1, 12), 2, '0', STR_PAD_LEFT);
$day = str_pad((string) rand(1, 28), 2, '0', STR_PAD_LEFT);
$dob = "{$year}-{$month}-{$day}";
$serial = 'BOT-' . str_pad((string) ($i + 1), 4, '0', STR_PAD_LEFT);
$playerId = $db->insert('players', [
'player_type' => 'non_member',
'registration_serial' => $serial,
'full_name_ar' => $fullName,
'full_name_en' => "Bot Player " . ($i + 1),
'date_of_birth' => $dob,
'gender' => 'male',
'phone' => '0100' . str_pad((string) rand(1000000, 9999999), 7, '0', STR_PAD_LEFT),
'medical_status' => 'cleared',
'card_status' => 'active',
'registration_fee_paid' => 1,
'is_archived' => 0,
'notes' => '[BOT] لاعب تجريبي لاختبار البطولات',
'created_at' => $ts,
'updated_at' => $ts,
]);
$playerIds[] = $playerId;
}
// Create a test tournament
$tournamentId = $db->insert('tournaments', [
'name_ar' => 'بطولة اختبارية — كرة القدم',
'name_en' => 'Test Tournament — Football',
'discipline_id' => 1,
'tournament_type' => 'individual',
'format' => 'knockout',
'gender' => 'male',
'max_participants' => 32,
'min_participants' => 8,
'registration_start' => date('Y-m-d', strtotime('-7 days')),
'registration_end' => date('Y-m-d', strtotime('+7 days')),
'start_date' => date('Y-m-d', strtotime('+14 days')),
'end_date' => date('Y-m-d', strtotime('+30 days')),
'entry_fee' => '0.00',
'status' => 'registration_open',
'notes' => '[BOT] بطولة تجريبية لاختبار النظام',
'created_at' => $ts,
'updated_at' => $ts,
]);
// Register all 32 players in the tournament
foreach ($playerIds as $idx => $playerId) {
$db->insert('tournament_participants', [
'tournament_id' => $tournamentId,
'player_id' => $playerId,
'seed_number' => $idx + 1,
'registration_date' => $ts,
'status' => 'registered',
'points' => 0,
'wins' => 0,
'losses' => 0,
'draws' => 0,
]);
}
echo "✅ Created 32 bot players (BOT-0001 to BOT-0032)\n";
echo "✅ Created tournament ID: {$tournamentId} (بطولة اختبارية — كرة القدم)\n";
echo "✅ Registered all 32 players in the tournament\n";
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment