From 6633d2b04113d4d636e4cc5554b4fd9599cea3b2 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 21 Oct 2023 17:15:54 +0200 Subject: [PATCH] Extract setup method --- .../tests/Unit/CreatesNewMarkdownPostFileTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/framework/tests/Unit/CreatesNewMarkdownPostFileTest.php b/packages/framework/tests/Unit/CreatesNewMarkdownPostFileTest.php index 01f93b83d02..6f81f01dab5 100644 --- a/packages/framework/tests/Unit/CreatesNewMarkdownPostFileTest.php +++ b/packages/framework/tests/Unit/CreatesNewMarkdownPostFileTest.php @@ -16,10 +16,15 @@ */ class CreatesNewMarkdownPostFileTest extends TestCase { - public function testWithDefaultData() + protected function setUp(): void { + parent::setUp(); + Carbon::setTestNow(Carbon::create(2024)); + } + public function testWithDefaultData() + { $action = new CreatesNewMarkdownPostFile('Example Title', null, null, null); $array = $action->toArray(); @@ -34,8 +39,6 @@ public function testWithDefaultData() public function testWithCustomData() { - Carbon::setTestNow(Carbon::create(2024)); - $action = new CreatesNewMarkdownPostFile('foo', 'bar', 'baz', 'qux'); $array = $action->toArray(); @@ -50,8 +53,6 @@ public function testWithCustomData() public function testSave() { - Carbon::setTestNow(Carbon::create(2024)); - $action = new CreatesNewMarkdownPostFile('Example Post', null, null, null); $action->save();