Passed
Push — master ( 9447cf...76f63b )
by Thomas
06:46
created

Test_CmsActionsModel   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 44
rs 10
wmc 7

7 Methods

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