diff --git a/tests/php/Controllers/LinkFieldControllerTest.php b/tests/php/Controllers/LinkFieldControllerTest.php index 03300a3c..b70ccb62 100644 --- a/tests/php/Controllers/LinkFieldControllerTest.php +++ b/tests/php/Controllers/LinkFieldControllerTest.php @@ -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', @@ -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' => '', + ], ]; }