2022-10-02 18:38:41 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
it('can create template', function () {
|
2022-11-16 14:57:10 +00:00
|
|
|
$user = $this->createUser([
|
|
|
|
'email' => 'admin@opnform.com'
|
|
|
|
]);
|
|
|
|
$this->actingAsUser($user);
|
2022-10-02 18:38:41 +00:00
|
|
|
|
|
|
|
// Create Form
|
|
|
|
$workspace = $this->createUserWorkspace($user);
|
|
|
|
$form = $this->makeForm($user, $workspace);
|
2022-11-16 14:57:10 +00:00
|
|
|
|
2022-10-02 18:38:41 +00:00
|
|
|
// Create Template
|
|
|
|
$templateData = [
|
|
|
|
'name' => 'Demo Template',
|
|
|
|
'slug' => 'demo_template',
|
2023-09-08 11:00:28 +00:00
|
|
|
'short_description' => 'Short description here...',
|
|
|
|
'description' => 'Some long description here...',
|
2022-10-02 18:38:41 +00:00
|
|
|
'image_url' => 'https://d3ietpyl4f2d18.cloudfront.net/6c35a864-ee3a-4039-80a4-040b6c20ac60/img/pages/welcome/product_cover.jpg',
|
2023-09-08 11:00:28 +00:00
|
|
|
'publicly_listed' => true,
|
2022-10-02 18:38:41 +00:00
|
|
|
'form' => $form->getAttributes(),
|
|
|
|
'questions' => [['question'=>'Question 1','answer'=>'Answer 1 will be here...']]
|
|
|
|
];
|
|
|
|
$this->postJson(route('templates.create', $templateData))
|
|
|
|
->assertSuccessful()
|
|
|
|
->assertJson([
|
|
|
|
'type' => 'success',
|
2023-09-08 11:00:28 +00:00
|
|
|
'message' => 'Template was created.'
|
2022-10-02 18:38:41 +00:00
|
|
|
]);
|
2022-11-16 14:57:10 +00:00
|
|
|
});
|