Skip to content

Commit

Permalink
Merge pull request #15217 from seamuslee001/group_nesting_group_org_test
Browse files Browse the repository at this point in the history
[TEST] Enable apiv4 testing for GroupNesting and GroupOrganization entities
  • Loading branch information
eileenmcnaughton authored Sep 5, 2019
2 parents b26a4ee + 0158c2b commit 6d23b2c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/phpunit/api/v3/GroupNestingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ protected function tearDown() {

/**
* Test civicrm_group_nesting_get.
*
* @dataProvider versionThreeAndFour
*/
public function testGet() {
$params = [
Expand All @@ -108,6 +110,8 @@ public function testGet() {

/**
* Test civicrm_group_nesting_get with just one param (child_group_id).
*
* @dataProvider versionThreeAndFour
*/
public function testGetWithChildGroupId() {
$params = [
Expand Down Expand Up @@ -135,6 +139,8 @@ public function testGetWithChildGroupId() {

/**
* Test civicrm_group_nesting_get with just one param (parent_group_id).
*
* @dataProvider versionThreeAndFour
*/
public function testGetWithParentGroupId() {
$params = [
Expand Down Expand Up @@ -169,7 +175,9 @@ public function testGetWithParentGroupId() {
* Test civicrm_group_nesting_get for no records results.
*
* Success expected. (these tests are of marginal value as are in syntax conformance,
* don't copy & paste
* don't copy & paste.
*
* @dataProvider versionThreeAndFour
*/
public function testGetEmptyResults() {
$params = [
Expand All @@ -183,6 +191,8 @@ public function testGetEmptyResults() {
* Test civicrm_group_nesting_create.
*
* @throws \Exception
*
* @dataProvider versionThreeAndFour
*/
public function testCreate() {
$params = [
Expand All @@ -196,6 +206,8 @@ public function testCreate() {

/**
* Test civicrm_group_nesting_remove.
*
* @dataProvider versionThreeAndFour
*/
public function testDelete() {
$params = [
Expand All @@ -213,6 +225,8 @@ public function testDelete() {
* Test civicrm_group_nesting_remove with empty parameter array.
*
* Error expected.
*
* @dataProvider versionThreeAndFour
*/
public function testDeleteWithEmptyParams() {
$this->callAPIFailure('group_nesting', 'delete', []);
Expand Down
28 changes: 28 additions & 0 deletions tests/phpunit/api/v3/GroupOrganizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ protected function setUp() {

/**
* Test civicrm_group_organization_get with valid params.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationGet() {

Expand All @@ -67,6 +69,8 @@ public function testGroupOrganizationGet() {

/**
* Test civicrm_group_organization_get with group_id.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationGetWithGroupId() {
$createParams = [
Expand All @@ -85,6 +89,8 @@ public function testGroupOrganizationGetWithGroupId() {

/**
* Test civicrm_group_organization_get with empty params.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationGetWithEmptyParams() {
$params = [];
Expand All @@ -95,6 +101,8 @@ public function testGroupOrganizationGetWithEmptyParams() {

/**
* Test civicrm_group_organization_get with wrong params.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationGetWithWrongParams() {
$params = 'groupOrg';
Expand All @@ -104,6 +112,8 @@ public function testGroupOrganizationGetWithWrongParams() {

/**
* Test civicrm_group_organization_get invalid keys.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationGetWithInvalidKeys() {
$params = [
Expand All @@ -118,6 +128,8 @@ public function testGroupOrganizationGetWithInvalidKeys() {

/**
* Check with valid params.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationCreate() {
$params = [
Expand All @@ -129,6 +141,8 @@ public function testGroupOrganizationCreate() {

/**
* CRM-13841 - Load Group Org before save
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationCreateTwice() {
$params = [
Expand All @@ -142,6 +156,8 @@ public function testGroupOrganizationCreateTwice() {

/**
* Check with empty params array.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationCreateWithEmptyParams() {
$params = [];
Expand All @@ -151,6 +167,8 @@ public function testGroupOrganizationCreateWithEmptyParams() {

/**
* Check with invalid params.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationCreateParamsNotArray() {
$params = 'group_org';
Expand All @@ -160,6 +178,8 @@ public function testGroupOrganizationCreateParamsNotArray() {

/**
* Check with invalid params keys.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationCreateWithInvalidKeys() {
$params = [
Expand All @@ -173,6 +193,8 @@ public function testGroupOrganizationCreateWithInvalidKeys() {

/**
* Test civicrm_group_organization_remove with params not an array.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationDeleteParamsNotArray() {
$params = 'delete';
Expand All @@ -182,6 +204,8 @@ public function testGroupOrganizationDeleteParamsNotArray() {

/**
* Test civicrm_group_organization_remove with empty params.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationDeleteWithEmptyParams() {
$params = [];
Expand All @@ -191,6 +215,8 @@ public function testGroupOrganizationDeleteWithEmptyParams() {

/**
* Test civicrm_group_organization_remove with valid params.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationDelete() {
$paramsC = [
Expand All @@ -207,6 +233,8 @@ public function testGroupOrganizationDelete() {

/**
* Test civicrm_group_organization_remove with invalid params key.
*
* @dataProvider versionThreeAndFour
*/
public function testGroupOrganizationDeleteWithInvalidKey() {
$paramsDelete = [
Expand Down

0 comments on commit 6d23b2c

Please sign in to comment.