Fix test create template

This commit is contained in:
JhumanJ 2022-11-16 15:57:10 +01:00
parent 88812776db
commit a192ca35f7
3 changed files with 11 additions and 8 deletions

View File

@ -32,7 +32,7 @@
<server name="MAIL_FROM_NAME" value="NotionForms"/> <server name="MAIL_FROM_NAME" value="NotionForms"/>
<server name="QUEUE_CONNECTION" value="sync"/> <server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/> <server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/> <server name="TEMPLATE_EDITOR_EMAILS" value="admin@opnform.com"/>
<server name="JWT_SECRET" value="9K6whOetAFaokQgSIdbMQZuJuDV5uS2Y"/> <server name="JWT_SECRET" value="9K6whOetAFaokQgSIdbMQZuJuDV5uS2Y"/>
</php> </php>
</phpunit> </phpunit>

View File

@ -1,12 +1,15 @@
<?php <?php
it('can create template', function () { it('can create template', function () {
$user = $this->actingAsUser(); $user = $this->createUser([
'email' => 'admin@opnform.com'
]);
$this->actingAsUser($user);
// Create Form // Create Form
$workspace = $this->createUserWorkspace($user); $workspace = $this->createUserWorkspace($user);
$form = $this->makeForm($user, $workspace); $form = $this->makeForm($user, $workspace);
// Create Template // Create Template
$templateData = [ $templateData = [
'name' => 'Demo Template', 'name' => 'Demo Template',
@ -22,4 +25,4 @@ it('can create template', function () {
'type' => 'success', 'type' => 'success',
'message' => 'Template created.' 'message' => 'Template created.'
]); ]);
}); });

View File

@ -125,7 +125,7 @@ trait TestHelpers
->withProperties(FormFactory::formatProperties($dbProperties)) ->withProperties(FormFactory::formatProperties($dbProperties))
->forWorkspace($workspace) ->forWorkspace($workspace)
->createdBy($user) ->createdBy($user)
->make($data); ->make($data);
} }
public function createForm(User $user, Workspace $workspace, array $data = []) public function createForm(User $user, Workspace $workspace, array $data = [])
@ -135,9 +135,9 @@ trait TestHelpers
return $form; 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() public function createProUser()
@ -191,5 +191,5 @@ trait TestHelpers
} }
$this->assertGuest(); $this->assertGuest();
} }
} }