feat(world): add persistent citizen simulation with needs, jobs, and social features
- Adds Character model with survival needs (hunger, thirst, energy) and state machine - Implements city:tick world ticker for offline progression every minute - Adds city territory expansion and building construction system - Introduces job economy, inventory, and transaction audit trail - Adds social graph (friends, marriage, children) and character chat - Implements admin approval workflow for new registrations - Adds hospital admission system for traffic accidents - Includes comprehensive feature tests and world seeders
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Character;
|
||||
use App\Models\City;
|
||||
use App\Models\User;
|
||||
use Database\Seeders\CityWorldSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* World schema and seeding coverage.
|
||||
*/
|
||||
class CityWorldSeedingTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* Seeder creates City10, jobs and a character for active users.
|
||||
*/
|
||||
public function test_seeder_bootstraps_city_jobs_and_characters(): void
|
||||
{
|
||||
$this->seed(CityWorldSeeder::class);
|
||||
|
||||
$city = City::query()->where('slug', 'city10')->first();
|
||||
$this->assertNotNull($city);
|
||||
$this->assertTrue($city->is_active);
|
||||
$this->assertSame(4, $city->jobs()->count());
|
||||
|
||||
$user = User::factory()->create(['status' => User::STATUS_ACTIVE, 'is_active' => true]);
|
||||
$this->seed(CityWorldSeeder::class);
|
||||
|
||||
$this->assertNotNull(Character::query()->where('user_id', $user->id)->first());
|
||||
}
|
||||
|
||||
/**
|
||||
* Migration backfills legacy is_active flags onto status.
|
||||
*/
|
||||
public function test_status_backfill_matches_is_active(): void
|
||||
{
|
||||
$this->seed(CityWorldSeeder::class);
|
||||
|
||||
$active = User::where('is_active', true)->where('status', '!=', User::STATUS_ACTIVE)->count();
|
||||
$this->assertSame(0, $active);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user