1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class OrderDetailTest extends SapphireTest |
4
|
|
|
{ |
5
|
|
|
/** |
6
|
|
|
* @var string |
7
|
|
|
*/ |
8
|
|
|
protected static $fixture_file = 'foxystripe/tests/FoxyStripeTest.yml'; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* |
12
|
|
|
*/ |
13
|
|
|
public function testGetCMSFields() |
14
|
|
|
{ |
15
|
|
|
$object = singleton('OrderDetail'); |
16
|
|
|
$fields = $object->getCMSFields(); |
17
|
|
|
$this->assertInstanceOf('FieldList', $fields); |
18
|
|
|
$this->assertNull($fields->dataFieldByName('Options')); |
|
|
|
|
19
|
|
|
|
20
|
|
|
$object = $this->objFromFixture('OrderDetail', 'one'); |
21
|
|
|
$fields = $object->getCMSFields(); |
22
|
|
|
$this->assertInstanceOf('FieldList', $fields); |
23
|
|
|
$this->assertNotNull($fields->dataFieldByName('Options')); |
|
|
|
|
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* |
28
|
|
|
*/ |
29
|
|
View Code Duplication |
public function testCanView() |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
$object = $this->objFromFixture('Order', 'one'); |
32
|
|
|
$admin = $this->objFromFixture('Member', 'admin'); |
33
|
|
|
$this->assertTrue($object->canView($admin)); |
|
|
|
|
34
|
|
|
$member = $this->objFromFixture('Member', 'customer'); |
35
|
|
|
$this->assertTrue($object->canView($member)); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* |
40
|
|
|
*/ |
41
|
|
View Code Duplication |
public function testCanEdit() |
|
|
|
|
42
|
|
|
{ |
43
|
|
|
$object = $this->objFromFixture('Order', 'one'); |
44
|
|
|
$admin = $this->objFromFixture('Member', 'admin'); |
45
|
|
|
$this->assertFalse($object->canEdit($admin)); |
|
|
|
|
46
|
|
|
$member = $this->objFromFixture('Member', 'customer'); |
47
|
|
|
$this->assertFalse($object->canEdit($member)); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* |
52
|
|
|
*/ |
53
|
|
View Code Duplication |
public function testCanDelete() |
|
|
|
|
54
|
|
|
{ |
55
|
|
|
$object = $this->objFromFixture('Order', 'one'); |
56
|
|
|
$admin = $this->objFromFixture('Member', 'admin'); |
57
|
|
|
$this->assertFalse($object->canDelete($admin)); |
|
|
|
|
58
|
|
|
$member = $this->objFromFixture('Member', 'customer'); |
59
|
|
|
$this->assertFalse($object->canDelete($member)); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* |
64
|
|
|
*/ |
65
|
|
View Code Duplication |
public function testCanCreate() |
|
|
|
|
66
|
|
|
{ |
67
|
|
|
$object = $this->objFromFixture('Order', 'one'); |
68
|
|
|
$admin = $this->objFromFixture('Member', 'admin'); |
69
|
|
|
$this->assertFalse($object->canCreate($admin)); |
|
|
|
|
70
|
|
|
$member = $this->objFromFixture('Member', 'customer'); |
71
|
|
|
$this->assertFalse($object->canCreate($member)); |
|
|
|
|
72
|
|
|
} |
73
|
|
|
} |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.