diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index b13ebe4d61ec..04c212d1f264 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -1752,9 +1752,9 @@ public function testDeleteEmptyParamsContribution() { } public function testDeleteParamsNotArrayContribution() { + $this->expectException(TypeError::class); $params = 'contribution_id= 1'; $contribution = $this->callAPIFailure('contribution', 'delete', $params); - $this->assertEquals($contribution['error_message'], 'Input variable `params` is not an array'); } public function testDeleteWrongParamContribution() { diff --git a/tests/phpunit/api/v3/CustomFieldTest.php b/tests/phpunit/api/v3/CustomFieldTest.php index 7d65df2a74f8..ecb40289f20e 100644 --- a/tests/phpunit/api/v3/CustomFieldTest.php +++ b/tests/phpunit/api/v3/CustomFieldTest.php @@ -31,16 +31,6 @@ public function tearDown() { parent::tearDown(); } - /** - * Check with no array. - */ - public function testCustomFieldCreateNoArray() { - $fieldParams = NULL; - - $customField = $this->callAPIFailure('custom_field', 'create', $fieldParams); - $this->assertEquals($customField['error_message'], 'Input variable `params` is not an array'); - } - /** * Check with no label. */ @@ -406,15 +396,6 @@ public function testCustomFieldCreateWithOptionValues() { ///////////////// civicrm_custom_field_delete methods - /** - * Check with no array. - */ - public function testCustomFieldDeleteNoArray() { - $params = NULL; - $customField = $this->callAPIFailure('custom_field', 'delete', $params); - $this->assertEquals($customField['error_message'], 'Input variable `params` is not an array'); - } - /** * Check without Field ID. */ diff --git a/tests/phpunit/api/v3/CustomGroupTest.php b/tests/phpunit/api/v3/CustomGroupTest.php index 5fd1adc1e64c..e891f28eb079 100644 --- a/tests/phpunit/api/v3/CustomGroupTest.php +++ b/tests/phpunit/api/v3/CustomGroupTest.php @@ -199,15 +199,6 @@ public function testCustomGroupCreateNoStyle() { $this->assertEquals($customGroup['values'][$customGroup['id']]['style'], 'Inline'); } - /** - * Check with not array. - */ - public function testCustomGroupCreateNotArray() { - $params = NULL; - $customGroup = $this->callAPIFailure('custom_group', 'create', $params); - $this->assertEquals($customGroup['error_message'], 'Input variable `params` is not an array'); - } - /** * Check without title. */ @@ -336,15 +327,6 @@ public function testCustomGroupDeleteWithoutGroupID() { $this->assertEquals($customGroup['error_message'], 'Mandatory key(s) missing from params array: id'); } - /** - * Check with no array. - */ - public function testCustomGroupDeleteNoArray() { - $params = NULL; - $customGroup = $this->callAPIFailure('custom_group', 'delete', $params); - $this->assertEquals($customGroup['error_message'], 'Input variable `params` is not an array'); - } - /** * Check with valid custom group id. */ diff --git a/tests/phpunit/api/v3/EventTest.php b/tests/phpunit/api/v3/EventTest.php index 9dd4b672275e..e547da041fca 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -756,17 +756,6 @@ public function testDeleteWithWrongEventId($version) { $result = $this->callAPIFailure('Event', 'Delete', $params); } - /** - * Test civicrm_event_search with wrong params type. - * @param int $version - * @dataProvider versionThreeAndFour - */ - public function testSearchWrongParamsType($version) { - $this->_apiversion = $version; - $params = 'a string'; - $result = $this->callAPIFailure('event', 'get', $params); - } - /** * Test civicrm_event_search with empty params. * @param int $version diff --git a/tests/phpunit/api/v3/GroupOrganizationTest.php b/tests/phpunit/api/v3/GroupOrganizationTest.php index 4006a5c6ab2f..4ed4ed9f0ca0 100644 --- a/tests/phpunit/api/v3/GroupOrganizationTest.php +++ b/tests/phpunit/api/v3/GroupOrganizationTest.php @@ -83,17 +83,6 @@ public function testGroupOrganizationGetWithEmptyParams() { $this->assertAPISuccess($result); } - /** - * Test civicrm_group_organization_get with wrong params. - * - * @dataProvider versionThreeAndFour - */ - public function testGroupOrganizationGetWithWrongParams() { - $params = 'groupOrg'; - $result = $this->callAPIFailure('group_organization', 'get', $params); - $this->assertEquals($result['error_message'], 'Input variable `params` is not an array'); - } - /** * Test civicrm_group_organization_get invalid keys. * @@ -149,17 +138,6 @@ public function testGroupOrganizationCreateWithEmptyParams() { $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: group_id, organization_id'); } - /** - * Check with invalid params. - * - * @dataProvider versionThreeAndFour - */ - public function testGroupOrganizationCreateParamsNotArray() { - $params = 'group_org'; - $result = $this->callAPIFailure('group_organization', 'create', $params); - $this->assertEquals($result['error_message'], 'Input variable `params` is not an array'); - } - /** * Check with invalid params keys. * @@ -175,17 +153,6 @@ public function testGroupOrganizationCreateWithInvalidKeys() { ///////////////// civicrm_group_organization_remove methods - /** - * Test civicrm_group_organization_remove with params not an array. - * - * @dataProvider versionThreeAndFour - */ - public function testGroupOrganizationDeleteParamsNotArray() { - $params = 'delete'; - $result = $this->callAPIFailure('group_organization', 'delete', $params); - $this->assertEquals($result['error_message'], 'Input variable `params` is not an array'); - } - /** * Test civicrm_group_organization_remove with empty params. * diff --git a/tests/phpunit/api/v3/JobProcessMailingTest.php b/tests/phpunit/api/v3/JobProcessMailingTest.php index 68f304629b3b..4334acecb885 100644 --- a/tests/phpunit/api/v3/JobProcessMailingTest.php +++ b/tests/phpunit/api/v3/JobProcessMailingTest.php @@ -189,7 +189,8 @@ public function testMailNonProductionRun() { ]); $this->callAPISuccess('mailing', 'create', $this->_params); $this->_mut->assertRecipients([]); - $this->callAPIFailure('job', 'process_mailing', "Failure in api call for job process_mailing: Job has not been executed as it is a non-production environment."); + $result = $this->callAPIFailure('job', 'process_mailing', []); + $this->assertEquals($result['error_message'], "Job has not been executed as it is a Staging (non-production) environment."); // Test with runInNonProductionEnvironment param. $this->callAPISuccess('job', 'process_mailing', ['runInNonProductionEnvironment' => TRUE]); diff --git a/tests/phpunit/api/v3/MailingContactTest.php b/tests/phpunit/api/v3/MailingContactTest.php index 5513438d3cde..0000fcf4fdb4 100644 --- a/tests/phpunit/api/v3/MailingContactTest.php +++ b/tests/phpunit/api/v3/MailingContactTest.php @@ -41,20 +41,6 @@ public function tearDown() { parent::tearDown(); } - /** - * Test that the api responds correctly to null params. - * - * Do not copy and paste. - * - * Tests like this that test the wrapper belong in the SyntaxConformance class - * (which already has a 'not array test) - * I have left this here in case 'null' isn't covered in that class - * but don't copy it only any other classes - */ - public function testMailingNullParams() { - $this->callAPIFailure('MailingContact', 'get', NULL); - } - public function testMailingContactGetFields() { $result = $this->callAPISuccess('MailingContact', 'getfields', [ 'action' => 'get', diff --git a/tests/phpunit/api/v3/MembershipPaymentTest.php b/tests/phpunit/api/v3/MembershipPaymentTest.php index 62512496e26c..8aa94d018db9 100644 --- a/tests/phpunit/api/v3/MembershipPaymentTest.php +++ b/tests/phpunit/api/v3/MembershipPaymentTest.php @@ -91,14 +91,6 @@ public function testCreate() { ///////////////// civicrm_membershipPayment_get methods - /** - * Test civicrm_membershipPayment_get with wrong params type. - */ - public function testGetWrongParamsType() { - $params = 'eeee'; - $GetWrongParamsType = $this->callAPIFailure('membership_payment', 'get', $params, 'Input variable `params` is not an array'); - } - /** * Test civicrm_membershipPayment_get - success expected. */ diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php index 1975ef74c1bd..7619412b760a 100644 --- a/tests/phpunit/api/v3/MembershipTest.php +++ b/tests/phpunit/api/v3/MembershipTest.php @@ -100,14 +100,6 @@ public function testMembershipDeleteInvalidID() { $this->callAPIFailure('membership', 'delete', ['id' => 'blah']); } - /** - * Test civicrm_membership_delete() with invalid Membership Id. - */ - public function testMembershipDeleteWithInvalidMembershipId() { - $membershipId = 'membership'; - $this->callAPIFailure('membership', 'delete', $membershipId); - } - /** * Test membership deletion and with the preserve contribution param. */ diff --git a/tests/phpunit/api/v3/ParticipantPaymentTest.php b/tests/phpunit/api/v3/ParticipantPaymentTest.php index 737a629f2f15..e040c69b8dda 100644 --- a/tests/phpunit/api/v3/ParticipantPaymentTest.php +++ b/tests/phpunit/api/v3/ParticipantPaymentTest.php @@ -60,14 +60,6 @@ public function setUp() { ]); } - /** - * Test civicrm_participant_payment_create with wrong params type. - */ - public function testPaymentCreateWrongParamsType() { - $params = 'a string'; - $this->callAPIFailure('participant_payment', 'create', $params); - } - /** * Test civicrm_participant_payment_create with empty params. */ @@ -130,15 +122,6 @@ public function testPaymentInfoForEvent() { ///////////////// civicrm_participant_payment_create methods - /** - * Test civicrm_participant payment create with wrong params type. - */ - public function testPaymentUpdateWrongParamsType() { - $params = 'a string'; - $result = $this->callAPIFailure('participant_payment', 'create', $params); - $this->assertEquals('Input variable `params` is not an array', $result['error_message']); - } - /** * Check with empty array. */ @@ -268,14 +251,6 @@ public function testPaymentPayLaterOnline() { $this->callAPISuccess('participant_payment', 'delete', $params); } - /** - * Test civicrm_participant_payment_delete with wrong params type. - */ - public function testPaymentDeleteWrongParamsType() { - $params = 'a string'; - $this->callAPIFailure('participant_payment', 'delete', $params); - } - /** * Check with empty array. */ diff --git a/tests/phpunit/api/v3/ParticipantTest.php b/tests/phpunit/api/v3/ParticipantTest.php index 1cbfbfb60f14..6c485116b467 100644 --- a/tests/phpunit/api/v3/ParticipantTest.php +++ b/tests/phpunit/api/v3/ParticipantTest.php @@ -645,15 +645,6 @@ public function testUpdateCreateParticipantFeeLevelNoSeparator() { ///////////////// civicrm_participant_update methods - /** - * Test civicrm_participant_update with wrong params type. - */ - public function testUpdateWrongParamsType() { - $params = 'a string'; - $result = $this->callAPIFailure('participant', 'create', $params); - $this->assertEquals('Input variable `params` is not an array', $result['error_message']); - } - /** * Check with empty array. */ @@ -720,14 +711,6 @@ public function testUpdateWithWrongContactId() { ///////////////// civicrm_participant_delete methods - /** - * Test civicrm_participant_delete with wrong params type. - */ - public function testDeleteWrongParamsType() { - $params = 'a string'; - $result = $this->callAPIFailure('participant', 'delete', $params); - } - /** * Test civicrm_participant_delete with empty params. */ diff --git a/tests/phpunit/api/v3/PaymentProcessorTypeTest.php b/tests/phpunit/api/v3/PaymentProcessorTypeTest.php index 56e2c4942724..9cbd9e5326ab 100644 --- a/tests/phpunit/api/v3/PaymentProcessorTypeTest.php +++ b/tests/phpunit/api/v3/PaymentProcessorTypeTest.php @@ -90,13 +90,6 @@ public function testPaymentProcessorTypeDeleteEmpty() { $result = $this->callAPIFailure('payment_processor_type', 'delete', $params); } - /** - * Check with No array. - */ - public function testPaymentProcessorTypeDeleteParamsNotArray() { - $result = $this->callAPIFailure('payment_processor_type', 'delete', 'string'); - } - /** * Check if required fields are not passed. */ @@ -141,14 +134,6 @@ public function testPaymentProcessorTypeUpdateEmpty() { $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: name, title, class_name, billing_mode'); } - /** - * Check with No array. - */ - public function testPaymentProcessorTypeUpdateParamsNotArray() { - $result = $this->callAPIFailure('payment_processor_type', 'create', 'string'); - $this->assertEquals($result['error_message'], 'Input variable `params` is not an array'); - } - /** * Check with all parameters. */ diff --git a/tests/phpunit/api/v3/RelationshipTypeTest.php b/tests/phpunit/api/v3/RelationshipTypeTest.php index 08efbece2b2c..b9b4f6706ad9 100644 --- a/tests/phpunit/api/v3/RelationshipTypeTest.php +++ b/tests/phpunit/api/v3/RelationshipTypeTest.php @@ -249,17 +249,6 @@ public function testRelationshipTypesGetEmptyParams($version) { $this->assertEquals(2, $results['count']); } - /** - * Check with params Not Array. - * @param int $version - * @dataProvider versionThreeAndFour - */ - public function testRelationshipTypesGetParamsNotArray($version) { - $this->_apiversion = $version; - - $results = $this->callAPIFailure('relationship_type', 'get', 'string'); - } - /** * Check with valid params array. * @param int $version diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 8d5e4617a394..c32ba6e9e118 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -809,21 +809,6 @@ public function testEmptyParam_get($Entity) { $this->assertContains("Unknown api version", $result['error_message']); } - /** - * @dataProvider entities_get - * @param $Entity - */ - public function testEmptyParam_getString($Entity) { - - if (in_array($Entity, $this->toBeImplemented['get'])) { - // $this->markTestIncomplete("civicrm_api3_{$Entity}_get to be implemented"); - return; - } - $result = $this->callAPIFailure($Entity, 'Get', 'string'); - $this->assertEquals(2000, $result['error_code']); - $this->assertEquals('Input variable `params` is not an array', $result['error_message']); - } - /** * @dataProvider entities_get * @Xdepends testEmptyParam_get // no need to test the simple if the empty doesn't work/is skipped. doesn't seem to work @@ -1317,15 +1302,6 @@ public function testInvalidID_create($Entity) { $result = $this->callAPIFailure($Entity, 'Create', ['id' => 999]); } - /** - * @dataProvider entities - */ - public function testCreateWrongTypeParamTag_create() { - $result = civicrm_api("Tag", 'Create', 'this is not a string'); - $this->assertEquals(1, $result['is_error']); - $this->assertEquals("Input variable `params` is not an array", $result['error_message']); - } - /** * @dataProvider entities_updatesingle * @@ -1591,15 +1567,6 @@ public function testInvalidID_delete($Entity) { $result = $this->callAPIFailure($Entity, 'Delete', ['id' => 999999]); } - /** - * @dataProvider entities - */ - public function testDeleteWrongTypeParamTag_delete() { - $result = civicrm_api("Tag", 'Delete', 'this is not a string'); - $this->assertEquals(1, $result['is_error']); - $this->assertEquals("Input variable `params` is not an array", $result['error_message']); - } - /** * Create two entities and make sure delete action only deletes one! * diff --git a/tests/phpunit/api/v3/UFJoinTest.php b/tests/phpunit/api/v3/UFJoinTest.php index eefe2b51d2a7..71f04a1bd1b6 100644 --- a/tests/phpunit/api/v3/UFJoinTest.php +++ b/tests/phpunit/api/v3/UFJoinTest.php @@ -81,17 +81,6 @@ public function testFindUFGroupId($version) { } } - /** - * @param int $version - * @dataProvider versionThreeAndFour - */ - public function testUFJoinEditWrongParamsType($version) { - $this->_apiversion = $version; - $params = 'a string'; - $result = $this->callAPIFailure('uf_join', 'create', $params); - $this->assertEquals($result['error_message'], 'Input variable `params` is not an array'); - } - /** * @param int $version * @dataProvider versionThreeAndFour diff --git a/tests/phpunit/api/v3/UFMatchTest.php b/tests/phpunit/api/v3/UFMatchTest.php index 9808dc8c96d8..2e1d50901ea1 100644 --- a/tests/phpunit/api/v3/UFMatchTest.php +++ b/tests/phpunit/api/v3/UFMatchTest.php @@ -75,16 +75,6 @@ public function testGetUFMatchID($version) { $this->assertEquals($result['values'][$result['id']]['contact_id'], 69); } - /** - * @param int $version - * @dataProvider versionThreeAndFour - */ - public function testGetUFMatchIDWrongParam($version) { - $this->_apiversion = $version; - $params = 'a string'; - $result = $this->callAPIFailure('uf_match', 'get', $params); - } - /** * Fetch uf id by contact id. * @param int $version @@ -99,16 +89,6 @@ public function testGetUFID($version) { $this->assertEquals($result['values'][$result['id']]['uf_id'], 42); } - /** - * @param int $version - * @dataProvider versionThreeAndFour - */ - public function testGetUFIDWrongParam($version) { - $this->_apiversion = $version; - $params = 'a string'; - $result = $this->callAPIFailure('uf_match', 'get', $params); - } - /** * Test civicrm_activity_create() using example code * @param int $version