Skip to content

Commit

Permalink
Inline
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 6, 2024
1 parent ee1abef commit 62582e4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/framework/src/Facades/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function create(string $username, ?string $name = null, ?string $w
*/
public static function get(string $username): PostAuthor
{
return PostAuthor::get($username);
return PostAuthor::newGet($username);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ public function __construct(string $username, ?string $name = null, ?string $web
$this->socials = $socials;
}

/** Get an Author from the config, or create it with the username. */
public static function get(string $username): static
{
return static::newGet($username);
}

/**
* Get the author by their username, or create a new instance with the supplied data.
*
Expand All @@ -114,7 +108,7 @@ public static function newGet(string|array $usernameOrData): static
public static function legacyGetOrCreate(string|array $data): static
{
if (is_string($data)) {
return static::get($data);
return PostAuthor::newGet($data);
}

return new static(...array_merge([
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/tests/Unit/Facades/AuthorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testGet()
$this->assertSame('Mr. Hyde', $author->name);
$this->assertSame('https://hydephp.com', $author->website);

$this->assertEquals(PostAuthor::get('foo'), Author::get('foo'));
$this->assertEquals(PostAuthor::newGet('foo'), Author::get('foo'));
}

public function testAll()
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/tests/Unit/PostAuthorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function testGetMethodReturnsConfigDefinedAuthorByUsername()
Config::set('hyde.authors', [
Author::create('foo', 'bar'),
]);
$author = PostAuthor::get('foo');
$author = PostAuthor::newGet('foo');

$this->assertInstanceOf(PostAuthor::class, $author);
$this->assertSame('foo', $author->username);
Expand All @@ -243,7 +243,7 @@ public function testGetMethodReturnsConfigDefinedAuthorByUsername()
public function testGetMethodReturnsNewAuthorIfUsernameNotFoundInConfig()
{
Config::set('hyde.authors', []);
$author = PostAuthor::get('foo');
$author = PostAuthor::newGet('foo');

$this->assertInstanceOf(PostAuthor::class, $author);
$this->assertSame('foo', $author->username);
Expand Down

0 comments on commit 62582e4

Please sign in to comment.