Passed
Push — master ( eaef7a...5f7861 )
by Robbie
03:03 queued 01:21
created

RestfulServerTestExceptionThrown::canCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\RestfulServer\Tests\Stubs;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\ORM\DataObject;
7
8
/**
9
 * Class RestfulServerTestExceptionThrown
10
 * @package SilverStripe\RestfulServer\Tests\Stubs
11
 *
12
 * @property string Content
13
 * @property string Title
14
 */
15
class RestfulServerTestExceptionThrown extends DataObject implements TestOnly
16
{
17
    private static $api_access = true;
0 ignored issues
show
introduced by
The private property $api_access is not used, and could be removed.
Loading history...
18
19
    private static $table_name = 'RestfulServerTestExceptionThrown';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
20
21
    private static $db = array(
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
22
        'Content' => 'Text',
23
        'Title' => 'Text',
24
    );
25
26
    public function onBeforeWrite()
27
    {
28
        parent::onBeforeWrite();
29
30
        throw new \Exception('This is an exception test');
31
    }
32
33
    public function canView($member = null)
34
    {
35
        return true;
36
    }
37
38
    public function canEdit($member = null)
39
    {
40
        return true;
41
    }
42
43
    public function canDelete($member = null)
44
    {
45
        return true;
46
    }
47
48
    public function canCreate($member = null, $context = array())
49
    {
50
        return true;
51
    }
52
}
53