silverstripe-australia /
advancedworkflow
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Tests for permissions on all Workflow Objects. |
||
| 4 | * These will obviousely need to be modified should additional workflow permissions come online. |
||
| 5 | * |
||
| 6 | * @author [email protected] |
||
| 7 | * @license BSD License (http://silverstripe.org/bsd-license/) |
||
| 8 | * @package advancedworkflow |
||
| 9 | * @subpackage tests |
||
| 10 | */ |
||
| 11 | class WorkflowPermissionsTest extends SapphireTest { |
||
|
0 ignored issues
–
show
|
|||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | public static $fixture_file = 'advancedworkflow/tests/workflowpermissions.yml'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Tests whether members with differing permissions, should be able to create & edit WorkflowDefinitions |
||
| 20 | */ |
||
| 21 | public function testWorkflowDefinitionCanPerms() { |
||
| 22 | // Very limited perms. No create. |
||
| 23 | $this->logInWithPermission('CMS_ACCESS_AdvancedWorkflowAdmin'); |
||
| 24 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'no-actions'); |
||
| 25 | $this->assertFalse($workflowdef->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 26 | |||
| 27 | // Limited perms. No create. |
||
| 28 | $this->logInWithPermission('VIEW_ACTIVE_WORKFLOWS'); |
||
| 29 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'no-actions'); |
||
| 30 | $this->assertFalse($workflowdef->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 31 | |||
| 32 | // Has perms. Can create. |
||
| 33 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 34 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'no-actions'); |
||
| 35 | $this->assertTrue($workflowdef->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 36 | |||
| 37 | // Limited perms. No delete |
||
| 38 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 39 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'no-actions'); |
||
| 40 | $this->assertFalse($workflowdef->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 41 | |||
| 42 | // Has perms. No delete |
||
| 43 | $this->logInWithPermission('DELETE_WORKFLOW'); |
||
| 44 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'no-actions'); |
||
| 45 | $this->assertTrue($workflowdef->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Tests whether members with differing permissions, should be able to create & edit WorkflowActions |
||
| 50 | */ |
||
| 51 | public function testWorkflowActionCanPerms() { |
||
| 52 | // Very limited perms. No create. |
||
| 53 | $this->logInWithPermission('CMS_ACCESS_AdvancedWorkflowAdmin'); |
||
| 54 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'with-actions'); |
||
| 55 | $this->assertFalse($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 56 | $this->assertFalse($workflowdef->Actions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 57 | $this->assertFalse($workflowdef->Actions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 58 | |||
| 59 | // Limited perms. No create or delete. |
||
| 60 | $this->logInWithPermission('VIEW_ACTIVE_WORKFLOWS'); |
||
| 61 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'with-actions'); |
||
| 62 | $this->assertFalse($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 63 | $this->assertFalse($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 64 | $this->assertFalse($workflowdef->Actions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 65 | |||
| 66 | // Has perms. Can create. |
||
| 67 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 68 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'with-actions'); |
||
| 69 | $this->assertTrue($workflowdef->Actions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 70 | $this->assertTrue($workflowdef->Actions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 71 | |||
| 72 | // Limited perms. No Delete |
||
| 73 | $this->assertFalse($workflowdef->Actions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Tests whether members with differing permissions, should be able to create & edit WorkflowActions |
||
| 78 | */ |
||
| 79 | public function testWorkflowTransitionPerms() { |
||
| 80 | // Very limited perms. No create. |
||
| 81 | $this->logInWithPermission('CMS_ACCESS_AdvancedWorkflowAdmin'); |
||
| 82 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'with-actions-and-transitions'); |
||
| 83 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 84 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 85 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 86 | |||
| 87 | // Limited perms. No create. |
||
| 88 | $this->logInWithPermission('VIEW_ACTIVE_WORKFLOWS'); |
||
| 89 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'with-actions-and-transitions'); |
||
| 90 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 91 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 92 | $this->assertFalse($workflowdef->Actions()->first()->Transitions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertFalse() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 93 | |||
| 94 | // Has perms. Can create. |
||
| 95 | $this->logInWithPermission('CREATE_WORKFLOW'); |
||
| 96 | $workflowdef = $this->objFromFixture('WorkflowDefinition', 'with-actions-and-transitions'); |
||
| 97 | $this->assertTrue($workflowdef->Actions()->first()->Transitions()->first()->canCreate()); |
||
|
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 98 | $this->assertTrue($workflowdef->Actions()->first()->Transitions()->first()->canEdit()); |
||
|
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 99 | $this->assertTrue($workflowdef->Actions()->first()->Transitions()->first()->canDelete()); |
||
|
0 ignored issues
–
show
The method
assertTrue() does not seem to exist on object<WorkflowPermissionsTest>.
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. Loading history...
|
|||
| 100 | } |
||
| 101 | |||
| 102 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.