Skip to content

Commit

Permalink
ENH Tidy up permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Dec 18, 2023
1 parent 55208f8 commit 517f0df
Showing 1 changed file with 108 additions and 108 deletions.
216 changes: 108 additions & 108 deletions tests/php/Controllers/LinkFieldControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ public function provideLinkFormPost(): array
// note: not duplicating code paths already tested with provideLinkFormGetSchema()
// e.g. Reject Invalid ID
return [
// 'Valid update existing record' => [
// 'idType' => 'existing',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => '',
// 'expectedCode' => 200,
// 'expectedMessage' => '',
// 'expectedLinkType' => 'existing',
// ],
'Valid update existing record' => [
'idType' => 'existing',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => '',
'expectedCode' => 200,
'expectedMessage' => '',
'expectedLinkType' => 'existing',
],
'Valid create new record' => [
'idType' => 'new-record',
'typeKey' => 'testphone',
Expand All @@ -248,105 +248,105 @@ public function provideLinkFormPost(): array
'expectedMessage' => '',
'expectedLinkType' => 'new-record',
],
// 'Invalid validate()' => [
// 'idType' => 'existing',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => 'validate',
// 'expectedCode' => 200,
// 'expectedMessage' => 'Fail was validate',
// 'expectedLinkType' => 'existing',
// ],
// 'Invalid getCMSCompositeValidator()' => [
// 'idType' => 'existing',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => 'cms-composite-validator',
// 'expectedCode' => 200,
// 'expectedMessage' => 'Fail was cms-composite-validator',
// 'expectedLinkType' => 'existing',
// ],
// 'Reject invalid ID' => [
// 'idType' => 'invalid',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => '',
// 'expectedCode' => 404,
// 'expectedMessage' => 'Invalid ID',
// 'expectedLinkType' => '',
// ],
// 'Reject missing ID' => [
// 'idType' => 'missing',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => '',
// 'expectedCode' => 404,
// 'expectedMessage' => 'Invalid ID',
// 'expectedLinkType' => '',
// ],
// 'Reject non-numeric ID' => [
// 'idType' => 'non-numeric',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => '',
// 'expectedCode' => 404,
// 'expectedMessage' => 'Invalid ID',
// 'expectedLinkType' => '',
// ],
// 'Reject invalid typeKey for new record' => [
// 'idType' => 'new-record',
// 'typeKey' => 'donut',
// 'dataType' => 'valid',
// 'fail' => '',
// 'expectedCode' => 404,
// 'expectedMessage' => 'Invalid typeKey',
// 'expectedLinkType' => '',
// ],
// 'Reject empty data' => [
// 'idType' => 'existing',
// 'typeKey' => 'testphone',
// 'dataType' => 'empty',
// 'fail' => '',
// 'expectedCode' => 400,
// 'expectedMessage' => 'Empty data',
// 'expectedLinkType' => '',
// ],
// 'Reject invalid-id data' => [
// 'idType' => 'existing',
// 'typeKey' => 'testphone',
// 'dataType' => 'invalid-id',
// 'fail' => '',
// 'expectedCode' => 400,
// 'expectedMessage' => 'Bad data',
// 'expectedLinkType' => '',
// ],
// 'Reject fail csrf-token' => [
// 'idType' => 'existing',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => 'csrf-token',
// 'expectedCode' => 400,
// 'expectedMessage' => 'Invalid CSRF token',
// 'expectedLinkType' => '',
// ],
// 'Reject fail canEdit() check existing record' => [
// 'idType' => 'existing',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => 'can-edit',
// 'expectedCode' => 403,
// 'expectedMessage' => 'Unauthorized',
// 'expectedLinkType' => '',
// ],
// 'Reject fail canCreate() check new record' => [
// 'idType' => 'new-record',
// 'typeKey' => 'testphone',
// 'dataType' => 'valid',
// 'fail' => 'can-create',
// 'expectedCode' => 403,
// 'expectedMessage' => 'Unauthorized',
// 'expectedLinkType' => '',
// ],
'Invalid validate()' => [
'idType' => 'existing',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => 'validate',
'expectedCode' => 200,
'expectedMessage' => 'Fail was validate',
'expectedLinkType' => 'existing',
],
'Invalid getCMSCompositeValidator()' => [
'idType' => 'existing',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => 'cms-composite-validator',
'expectedCode' => 200,
'expectedMessage' => 'Fail was cms-composite-validator',
'expectedLinkType' => 'existing',
],
'Reject invalid ID' => [
'idType' => 'invalid',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => '',
'expectedCode' => 404,
'expectedMessage' => 'Invalid ID',
'expectedLinkType' => '',
],
'Reject missing ID' => [
'idType' => 'missing',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => '',
'expectedCode' => 404,
'expectedMessage' => 'Invalid ID',
'expectedLinkType' => '',
],
'Reject non-numeric ID' => [
'idType' => 'non-numeric',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => '',
'expectedCode' => 404,
'expectedMessage' => 'Invalid ID',
'expectedLinkType' => '',
],
'Reject invalid typeKey for new record' => [
'idType' => 'new-record',
'typeKey' => 'donut',
'dataType' => 'valid',
'fail' => '',
'expectedCode' => 404,
'expectedMessage' => 'Invalid typeKey',
'expectedLinkType' => '',
],
'Reject empty data' => [
'idType' => 'existing',
'typeKey' => 'testphone',
'dataType' => 'empty',
'fail' => '',
'expectedCode' => 400,
'expectedMessage' => 'Empty data',
'expectedLinkType' => '',
],
'Reject invalid-id data' => [
'idType' => 'existing',
'typeKey' => 'testphone',
'dataType' => 'invalid-id',
'fail' => '',
'expectedCode' => 400,
'expectedMessage' => 'Bad data',
'expectedLinkType' => '',
],
'Reject fail csrf-token' => [
'idType' => 'existing',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => 'csrf-token',
'expectedCode' => 400,
'expectedMessage' => 'Invalid CSRF token',
'expectedLinkType' => '',
],
'Reject fail canEdit() check existing record' => [
'idType' => 'existing',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => 'can-edit',
'expectedCode' => 403,
'expectedMessage' => 'Unauthorized',
'expectedLinkType' => '',
],
'Reject fail canCreate() check new record' => [
'idType' => 'new-record',
'typeKey' => 'testphone',
'dataType' => 'valid',
'fail' => 'can-create',
'expectedCode' => 403,
'expectedMessage' => 'Unauthorized',
'expectedLinkType' => '',
],
];
}

Expand Down

0 comments on commit 517f0df

Please sign in to comment.