From a192ca35f7e7546639d50ad04cbf1250c5f3bbe8 Mon Sep 17 00:00:00 2001 From: JhumanJ Date: Wed, 16 Nov 2022 15:57:10 +0100 Subject: [PATCH] Fix test create template --- phpunit.xml | 2 +- tests/Feature/TemplateTest.php | 9 ++++++--- tests/TestHelpers.php | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 60b6ce8..4ca3838 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -32,7 +32,7 @@ - + diff --git a/tests/Feature/TemplateTest.php b/tests/Feature/TemplateTest.php index 172ca20..62637b6 100644 --- a/tests/Feature/TemplateTest.php +++ b/tests/Feature/TemplateTest.php @@ -1,12 +1,15 @@ actingAsUser(); + $user = $this->createUser([ + 'email' => 'admin@opnform.com' + ]); + $this->actingAsUser($user); // Create Form $workspace = $this->createUserWorkspace($user); $form = $this->makeForm($user, $workspace); - + // Create Template $templateData = [ 'name' => 'Demo Template', @@ -22,4 +25,4 @@ it('can create template', function () { 'type' => 'success', 'message' => 'Template created.' ]); -}); \ No newline at end of file +}); diff --git a/tests/TestHelpers.php b/tests/TestHelpers.php index 00f098d..a047020 100644 --- a/tests/TestHelpers.php +++ b/tests/TestHelpers.php @@ -125,7 +125,7 @@ trait TestHelpers ->withProperties(FormFactory::formatProperties($dbProperties)) ->forWorkspace($workspace) ->createdBy($user) - ->make($data); + ->make($data); } public function createForm(User $user, Workspace $workspace, array $data = []) @@ -135,9 +135,9 @@ trait TestHelpers return $form; } - public function createUser() + public function createUser(array $data = []) { - return \App\Models\User::factory()->create(); + return \App\Models\User::factory()->create($data); } public function createProUser() @@ -191,5 +191,5 @@ trait TestHelpers } $this->assertGuest(); } - + }