<?php

use App\Models\Location;
use App\Models\SubLocation;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

test('sub location belongs to location', function () {
    $parent = Location::factory()->create();
    $sub = SubLocation::factory()->create(['location_id' => $parent->id]);

    expect($sub->location->id)->toBe($parent->id);
    expect($parent->subLocations)->toHaveCount(1);
});
