Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor author configuration system #449

Merged
merged 30 commits into from
May 23, 2022
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4272d03
Sketch out the Author helper
caendesilva May 23, 2022
76ef9c8
Add name identifiers to Author arguments
caendesilva May 23, 2022
884828a
Create Image.php
caendesilva May 23, 2022
16c6f1f
Merge branch 'master' of github.com:hydephp/framework
caendesilva May 23, 2022
de34b64
Change $displayName to $display_name
caendesilva May 23, 2022
dc43c83
Sketch out the test class
caendesilva May 23, 2022
04fde24
Import classes
caendesilva May 23, 2022
6c5261f
Fix whitespace typo in array key
caendesilva May 23, 2022
cd379f7
Test creation of Author model
caendesilva May 23, 2022
6b976ac
Sketch out the Author helper
caendesilva May 23, 2022
19213d6
Add Author collection methods
caendesilva May 23, 2022
c1990f6
Add get method to find Author in config
caendesilva May 23, 2022
f9b7494
Set method visibility to public
caendesilva May 23, 2022
11726a4
Remove Copilot comments
caendesilva May 23, 2022
99fbdab
Clean up test code
caendesilva May 23, 2022
fa6c3bf
Update PHPDoc comments
caendesilva May 23, 2022
ab6cafc
Add information to PHPDoc as to why an array is used
caendesilva May 23, 2022
5b56e9b
Deprecate AuthorService
caendesilva May 23, 2022
c4fdddb
Add inline documentation
caendesilva May 23, 2022
2204832
Use the new helper in the findAuthor method
caendesilva May 23, 2022
ba4344d
Add helper to remove dependency on AuthorService
caendesilva May 23, 2022
9f9d64d
Remove AuthorService
caendesilva May 23, 2022
990dcfc
Finalize removal of authors.yml
caendesilva May 23, 2022
1660ce3
Apply fixes from StyleCI
StyleCIBot May 23, 2022
5448c1d
Merge pull request #448 from hydephp/analysis-e7mE3P
May 23, 2022
b6dcd63
Add underscore to sample name
caendesilva May 23, 2022
359fd07
Add exxtra test case for multiple authors
caendesilva May 23, 2022
eb67873
Merge branch 'refactor-author-system' of github.com:hydephp/framework…
caendesilva May 23, 2022
ba7c2cc
Change display_name to name to match front matter
caendesilva May 23, 2022
a58408f
Update Author config documentation
caendesilva May 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up test code
  • Loading branch information
caendesilva committed May 23, 2022
commit 99fbdab58601f3d8e2db74c0b8b7df08a8ed6e4b
14 changes: 7 additions & 7 deletions tests/Feature/AuthorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ class AuthorHelperTest extends TestCase
{
public function test_create_method_creates_new_author_model()
{
$author = AuthorHelper::create('mr_hyde');
$author = AuthorHelper::create('foo');

$this->assertInstanceOf(AuthorModel::class, $author);
}

public function test_create_method_accepts_all_parameters()
{
$author = AuthorHelper::create('mr_hyde', 'Mr Hyde', 'https://mrhyde.com');
$author = AuthorHelper::create('foo', 'bar', 'https://example.com');

$this->assertEquals('mr_hyde', $author->username);
$this->assertEquals('Mr Hyde', $author->name);
$this->assertEquals('https://mrhyde.com', $author->website);
$this->assertEquals('foo', $author->username);
$this->assertEquals('bar', $author->name);
$this->assertEquals('https://example.com', $author->website);
}

public function test_all_method_returns_empty_collection_if_no_authors_are_set_in_config()
Expand All @@ -43,13 +43,13 @@ public function test_all_method_returns_empty_collection_if_no_authors_are_set_i
public function test_all_method_returns_collection_with_all_authors_defined_in_config()
{
Config::set('authors', [
AuthorHelper::create('mr_hyde')
AuthorHelper::create('foo')
]);
$authors = AuthorHelper::all();

$this->assertInstanceOf(Collection::class, $authors);
$this->assertCount(1, $authors);
$this->assertEquals(AuthorHelper::create('mr_hyde'), $authors->first());
$this->assertEquals(AuthorHelper::create('foo'), $authors->first());
}

public function test_get_method_returns_config_defined_author_by_username()
Expand Down