20-02-2026
This commit is contained in:
parent
854ce02bf6
commit
4d6b4930b2
128 changed files with 18247 additions and 2093 deletions
39
tests/Feature/Models/UserRelationshipsTest.php
Normal file
39
tests/Feature/Models/UserRelationshipsTest.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\UserOrigin;
|
||||
use App\Models\Hub;
|
||||
use App\Models\Partner;
|
||||
use App\Models\User;
|
||||
|
||||
test('user can have a hub', function () {
|
||||
$hub = Hub::factory()->create();
|
||||
$user = User::factory()->create(['hub_id' => $hub->id]);
|
||||
|
||||
expect($user->hub->id)->toBe($hub->id);
|
||||
});
|
||||
|
||||
test('user can have an origin', function () {
|
||||
$user = User::factory()->create(['origin' => 'style2own']);
|
||||
|
||||
expect($user->origin)->toBe(UserOrigin::Style2Own);
|
||||
});
|
||||
|
||||
test('user origin casts stileigentum correctly', function () {
|
||||
$user = User::factory()->create(['origin' => 'stileigentum']);
|
||||
|
||||
expect($user->origin)->toBe(UserOrigin::StilEigentum);
|
||||
expect($user->origin->tonality())->toBe('sie');
|
||||
});
|
||||
|
||||
test('user origin can be null', function () {
|
||||
$user = User::factory()->create(['origin' => null]);
|
||||
|
||||
expect($user->origin)->toBeNull();
|
||||
});
|
||||
|
||||
test('user belongs to partner', function () {
|
||||
$partner = Partner::factory()->create();
|
||||
$user = User::factory()->create(['partner_id' => $partner->id]);
|
||||
|
||||
expect($user->partner->id)->toBe($partner->id);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue