@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | SampleManageableObjectPage::class, |
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Ensure any current member is logged out |
|
| 33 | - */ |
|
| 34 | - public function logOut() |
|
| 35 | - { |
|
| 36 | - if ($member = Security::getCurrentUser()) { |
|
| 37 | - Security::setCurrentUser(null); |
|
| 38 | - } |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Ensure any current member is logged out |
|
| 33 | + */ |
|
| 34 | + public function logOut() |
|
| 35 | + { |
|
| 36 | + if ($member = Security::getCurrentUser()) { |
|
| 37 | + Security::setCurrentUser(null); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function testGetAddLink() |
| 54 | 54 | { |
| 55 | - /** @var SampleManageableObjectPage $page */ |
|
| 56 | - $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
|
| 57 | - /** @var SampleManageableDataObject $object */ |
|
| 58 | - $object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
|
| 55 | + /** @var SampleManageableObjectPage $page */ |
|
| 56 | + $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
|
| 57 | + /** @var SampleManageableDataObject $object */ |
|
| 58 | + $object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
|
| 59 | 59 | |
| 60 | 60 | $this->logOut(); |
| 61 | 61 | $this->assertFalse($object->getAddLink()); |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function testGetEditLink() |
| 74 | 74 | { |
| 75 | - /** @var SampleManageableObjectPage $page */ |
|
| 76 | - $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
|
| 77 | - /** @var SampleManageableDataObject $object */ |
|
| 78 | - $object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
|
| 75 | + /** @var SampleManageableObjectPage $page */ |
|
| 76 | + $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
|
| 77 | + /** @var SampleManageableDataObject $object */ |
|
| 78 | + $object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
|
| 79 | 79 | |
| 80 | 80 | $this->logOut(); |
| 81 | 81 | $this->assertFalse($object->getEditLink()); |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function testGetDeleteLink() |
| 94 | 94 | { |
| 95 | - /** @var SampleManageableObjectPage $page */ |
|
| 95 | + /** @var SampleManageableObjectPage $page */ |
|
| 96 | 96 | $page = $this->objFromFixture(SampleManageableObjectPage::class, 'one'); |
| 97 | - /** @var SampleManageableDataObject $object */ |
|
| 97 | + /** @var SampleManageableDataObject $object */ |
|
| 98 | 98 | $object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
| 99 | 99 | |
| 100 | 100 | $this->logOut(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | parent::setUp(); |
| 36 | 36 | // Suppress themes |
| 37 | - SSViewer::config()->update('theme_enabled', false); |
|
| 37 | + SSViewer::config()->update('theme_enabled', false); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public function logOut() |
| 44 | 44 | { |
| 45 | 45 | if ($member = Security::getCurrentUser()) { |
| 46 | - Security::setCurrentUser(null); |
|
| 46 | + Security::setCurrentUser(null); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $this->logInWithPermission('MDO_Edit'); |
| 67 | 67 | $object = $this->objFromFixture(SampleManageableDataObject::class, 'one'); |
| 68 | - $response = $this->get('/SampleManageableObjectPage_Controller/edit/' . $object->ID); |
|
| 68 | + $response = $this->get('/SampleManageableObjectPage_Controller/edit/'.$object->ID); |
|
| 69 | 69 | $this->assertEquals(200, $response->getStatusCode()); |
| 70 | 70 | $this->logOut(); |
| 71 | 71 | |
| 72 | - $response2 = $this->get('/SampleManageableObjectPage_Controller/edit/' . 0); |
|
| 72 | + $response2 = $this->get('/SampleManageableObjectPage_Controller/edit/'.0); |
|
| 73 | 73 | $this->assertEquals(404, $response2->getStatusCode()); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $this->logInWithPermission('MDO_Delete'); |
| 88 | 88 | |
| 89 | - $response404 = $this->get('/SampleManageableObjectPage_Controller/delete/' . 0); |
|
| 89 | + $response404 = $this->get('/SampleManageableObjectPage_Controller/delete/'.0); |
|
| 90 | 90 | $this->assertEquals(404, $response404->getStatusCode()); |
| 91 | 91 | |
| 92 | - $success = $this->get('/SampleManageableObjectPage_Controller/delete/' . $id); |
|
| 92 | + $success = $this->get('/SampleManageableObjectPage_Controller/delete/'.$id); |
|
| 93 | 93 | $this->assertEquals(200, $success->getStatusCode()); |
| 94 | 94 | $this->assertNull(SampleManageableDataObject::get()->byID($id)); |
| 95 | 95 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $record = SampleManageableDataObject::get()->filter($data)->first(); |
| 116 | 116 | $this->assertInstanceOf(SampleManageableDataObject::class, $record); |
| 117 | - $this->assertTrue($record->exists());//*/ |
|
| 117 | + $this->assertTrue($record->exists()); //*/ |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | } |
@@ -16,36 +16,36 @@ |
||
| 16 | 16 | class SampleManageableObjectPageController extends \PageController implements TestOnly |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var array |
|
| 21 | - */ |
|
| 22 | - private static $allowed_actions = [ |
|
| 23 | - 'Form', |
|
| 24 | - ]; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var array |
|
| 28 | - */ |
|
| 29 | - private static $extensions = [ |
|
| 30 | - ManageableDataObjectExtension::class |
|
| 31 | - ]; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 36 | - private static $managed_object = SampleManageableDataObject::class; |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * |
|
| 40 | - */ |
|
| 41 | - public function init() |
|
| 42 | - { |
|
| 43 | - parent::init(); |
|
| 44 | - Requirements::clear(); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - public function Form() |
|
| 48 | - { |
|
| 49 | - return ManageableDataObjectForm::create($this, 'Form', $this->config()->get('managed_object')); |
|
| 50 | - } |
|
| 19 | + /** |
|
| 20 | + * @var array |
|
| 21 | + */ |
|
| 22 | + private static $allowed_actions = [ |
|
| 23 | + 'Form', |
|
| 24 | + ]; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var array |
|
| 28 | + */ |
|
| 29 | + private static $extensions = [ |
|
| 30 | + ManageableDataObjectExtension::class |
|
| 31 | + ]; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | + private static $managed_object = SampleManageableDataObject::class; |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * |
|
| 40 | + */ |
|
| 41 | + public function init() |
|
| 42 | + { |
|
| 43 | + parent::init(); |
|
| 44 | + Requirements::clear(); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + public function Form() |
|
| 48 | + { |
|
| 49 | + return ManageableDataObjectForm::create($this, 'Form', $this->config()->get('managed_object')); |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -48,12 +48,12 @@ |
||
| 48 | 48 | ]; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @param null $member |
|
| 53 | - * @param array $context |
|
| 54 | - * |
|
| 55 | - * @return bool|int |
|
| 56 | - */ |
|
| 51 | + /** |
|
| 52 | + * @param null $member |
|
| 53 | + * @param array $context |
|
| 54 | + * |
|
| 55 | + * @return bool|int |
|
| 56 | + */ |
|
| 57 | 57 | public function canCreate($member = null, $context = array()) |
| 58 | 58 | { |
| 59 | 59 | return Permission::check('MDO_Create', 'any', $member); |