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

Test_CmsActionsModel::canEdit()   A

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 1
dl 0
loc 3
rs 10
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