Test_CmsActionsModel   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 22
c 3
b 0
f 0
dl 0
loc 62
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getCMSUtils() 0 4 1
A groupedAction1() 0 3 1
A getCancelButtonTitle() 0 3 1
A testAction() 0 3 1
A groupedAction2() 0 3 1
A canEdit() 0 3 1
A getDeleteButtonTitle() 0 3 1
A getCMSActions() 0 13 1
A canDelete() 0 3 1
1
<?php
2
3
namespace LeKoala\CmsActions\Test;
4
5
use LeKoala\CmsActions\ActionButtonsGroup;
6
use LeKoala\CmsActions\CustomAction;
7
use SilverStripe\Dev\TestOnly;
8
use SilverStripe\Forms\FieldList;
9
use SilverStripe\ORM\DataObject;
10
11
class Test_CmsActionsModel extends DataObject implements TestOnly
12
{
13
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
14
        "Name" => "Varchar",
15
    ];
16
    private static $has_one = [];
0 ignored issues
show
introduced by
The private property $has_one is not used, and could be removed.
Loading history...
17
    private static $table_name = 'CmsActionsModel';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
18
19
    public function getCMSActions()
20
    {
21
        $actions = parent::getCMSActions();
22
        $actions->push(new CustomAction('testAction', 'Test Action'));
23
24
        $groupedButtons = [
25
            new CustomAction("groupedAction1", "Grouped Action 1"),
26
            new CustomAction("groupedAction2", "Grouped Action 2"),
27
        ];
28
        $btnGroup = new ActionButtonsGroup($groupedButtons);
29
        $actions->push($btnGroup);
30
31
        return $actions;
32
    }
33
34
    public function getCMSUtils()
35
    {
36
        $utils = new FieldList();
37
        return $utils;
38
    }
39
40
    public function canDelete($member = null)
41
    {
42
        return true;
43
    }
44
45
    public function canEdit($member = null)
46
    {
47
        return true;
48
    }
49
50
    public function testAction()
51
    {
52
        return 'called testAction';
53
    }
54
55
    public function groupedAction1()
56
    {
57
        return 'called groupedAction1';
58
    }
59
60
    public function groupedAction2()
61
    {
62
        return 'called groupedAction2';
63
    }
64
65
    public function getDeleteButtonTitle()
66
    {
67
        return 'Delete this!';
68
    }
69
70
    public function getCancelButtonTitle()
71
    {
72
        return 'Maybe not!';
73
    }
74
}
75