Test_CmsActionsModel::testAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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