Skip to content

Commit faf11b4

Browse files
committed
test(database): use proper relation on test model
1 parent b846c9a commit faf11b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/Integration/Database/ModelsWithoutIdTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Tests\Tempest\Integration\Database;
66

7+
use Tempest\Database\BelongsTo;
78
use Tempest\Database\DatabaseMigration;
89
use Tempest\Database\Exceptions\ModelDidNotHavePrimaryColumn;
910
use Tempest\Database\HasOne;
@@ -259,7 +260,7 @@ public function test_load_with_relation_works_for_models_with_id(): void
259260
);
260261

261262
model(TestProfile::class)->create(
262-
user_id: $user->id->value,
263+
user: $user,
263264
bio: 'Ancient elf mage who loves magic and collecting spells',
264265
age: 1000,
265266
);
@@ -330,11 +331,10 @@ final class TestProfile
330331

331332
public ?PrimaryKey $id = null;
332333

333-
#[HasOne]
334+
#[BelongsTo(ownerJoin: 'user_id')]
334335
public ?TestUser $user;
335336

336337
public function __construct(
337-
public int $user_id,
338338
public string $bio,
339339
public int $age,
340340
) {}

0 commit comments

Comments
 (0)