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 tests #82

Merged
merged 21 commits into from
Apr 10, 2022
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Next Next commit
Clean up after test
  • Loading branch information
caendesilva committed Apr 10, 2022
commit 0d8a0e3ee8c264c4aeee998f32358125b05842d1
26 changes: 26 additions & 0 deletions tests/Feature/AuthorServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@

class AuthorServiceTest extends TestCase
{
public function test_setup()
{
// If an authors.yml file exists, back it up and remove it
$service = new AuthorService();
$path = $service->filepath;

backup($path);
unlinkIfExists($path);

$this->assertTrue(true);
}

public function test_publish_file_creates_file()
{
$service = new AuthorService();
Expand Down Expand Up @@ -73,4 +85,18 @@ public function test_get_yaml_can_parse_file()
],
], $array);
}

public function test_teardown()
{
// Clean up any test files
$service = new AuthorService();
$path = $service->filepath;
unlinkIfExists($path);

// Restore the original authors.yml file

restore($path);

$this->assertTrue(true);
}
}