Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
realodix committed Apr 30, 2024
1 parent dbbcc6e commit 2b7f631
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
7 changes: 1 addition & 6 deletions app/Models/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class Url extends Model

const GUEST_ID = null;

const GUEST_NAME = 'Guest';

const TITLE_LENGTH = 255;

/**
Expand Down Expand Up @@ -73,10 +71,7 @@ protected function casts(): array
*/
public function author()
{
return $this->belongsTo(User::class, 'user_id')
->withDefault([
'name' => self::GUEST_NAME,
]);
return $this->belongsTo(User::class, 'user_id');
}

/**
Expand Down
12 changes: 0 additions & 12 deletions tests/Unit/Models/UrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ public function hasManyVisitModel(): void
$this->assertInstanceOf(Url::class, $v->url);
}

/**
* The default guest name must be Guest.
*/
#[Test]
#[Group('u-model')]
public function defaultGuestName(): void
{
$url = Url::factory()->create(['user_id' => Url::GUEST_ID]);

$this->assertSame(Url::GUEST_NAME, $url->author->name);
}

/**
* The default guest id must be null.
*/
Expand Down

0 comments on commit 2b7f631

Please sign in to comment.