TestForm   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 37
ccs 19
cts 19
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 28 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * TestForm
6
 */
7
8
namespace Fr3nch13\Jira\Form;
9
10
use Cake\Event\EventManager;
11
12
/**
13
 * Test Form
14
 *
15
 * Used to submit a Test to Jira.
16
 * This is mainly used for 2 reasons.
17
 * - An example of how to add another type othen than a Bug or FeatureRequest.
18
 * - Used by the unit tests to make sure a non-standard type is still working.
19
 */
20
class TestForm extends AppForm
21
{
22
    /**
23
     * Constructor
24
     *
25
     * @param \Cake\Event\EventManager|null $eventManager The event manager.
26
     *  Defaults to a new instance.
27
     * @return void
28
     */
29 4
    public function __construct(?EventManager $eventManager = null)
30
    {
31 4
        $this->issueType = 'Test';
32
33 4
        $this->settings = [
34
            // a valid Jira issue type
35 4
            'jiraType' => 'Task',
36
            // any labels that you want that issue tagged with. space seperated string, or an array.
37 4
            'jiraLabels' => 'test-label',
38
            // data used in this form.
39 4
            'formData' => [
40
                // define the fields here for the HtmlHelper::control()
41 4
                'fields' => [
42
                    // this is really the only required field.
43 4
                    'summary' => [
44 4
                        'type' => 'string',
45 4
                        'required' => true,
46 4
                    ],
47
                    // add more fields here, like description, etc.
48 4
                    'details' => [
49 4
                        'type' => 'textarea',
50 4
                        'required' => true,
51 4
                    ],
52 4
                ],
53 4
            ],
54 4
        ];
55
56 4
        parent::__construct($eventManager);
57
    }
58
}
59