Skip to content

Commit

Permalink
Merge pull request #15546 from eileenmcnaughton/group_type
Browse files Browse the repository at this point in the history
dev/core#1321 [test] add unit test to demonstrate behaviour
  • Loading branch information
seamuslee001 authored Oct 24, 2019
2 parents 2f08eb6 + 4f92030 commit 97a7308
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/phpunit/api/v3/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ public function testGroupTypeWithPseudoconstantArray() {
$this->assertAPIArrayComparison([2, 1], $groupType);
}

/**
* Test / demonstrate behaviour when attempting to filter by group_type.
*
* Per https://lab.civicrm.org/dev/core/issues/1321 the group_type filter is deceptive
* - it only filters on exact match not 'is one of'.
*
* @throws \CRM_Core_Exception
*/
public function testGroupWithGroupTypeFilter() {
$this->groupCreate(['group_type' => ['Access Control'], 'name' => 'access_list', 'title' => 'access list']);
$this->groupCreate(['group_type' => ['Mailing List'], 'name' => 'mailing_list', 'title' => 'mailing list']);
$this->groupCreate(['group_type' => ['Access Control', 'Mailing List'], 'name' => 'group', 'title' => 'group']);
$group = $this->callAPISuccessGetSingle('Group', ['return' => 'id,title,group_type', 'group_type' => 'Mailing List']);
$this->assertEquals('mailing list', $group['title']);
}

/**
* @param int $version
*
Expand Down

0 comments on commit 97a7308

Please sign in to comment.