Merge pull request #19806 from eileenmcnaughton/msg_compat
[civicrm-core.git] / tests / phpunit / CRM / Contact / BAO / GroupTest.php
index 1b50f79b52e740deb46e5eea2f3c0a0719af5b1f..12a30dd15a08d2db86c7c5f7618907fd302f8981 100644 (file)
  */
 class CRM_Contact_BAO_GroupTest extends CiviUnitTestCase {
 
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   *
-   * This method is called before a test is executed.
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
   /**
    * Tears down the fixture, for example, closes a network connection.
    *
    * This method is called after a test is executed.
    */
-  protected function tearDown() {
+  protected function tearDown(): void {
     $this->quickCleanup(['civicrm_mapping_field', 'civicrm_mapping', 'civicrm_group', 'civicrm_saved_search']);
   }
 
@@ -142,9 +133,11 @@ class CRM_Contact_BAO_GroupTest extends CiviUnitTestCase {
       'parents' => [
         $group2->id => 1,
       ],
+      'group_type' => ['2' => 1],
     ];
     $group3 = CRM_Contact_BAO_Group::create($params);
 
+    unset(Civi::$statics['CRM_Core_Permission_Base']);
     // Check with no group type restriction
     $nestedGroup = CRM_Core_PseudoConstant::nestedGroup();
     $this->assertEquals([
@@ -155,7 +148,10 @@ class CRM_Contact_BAO_GroupTest extends CiviUnitTestCase {
 
     // Check restrict to mailing groups
     $nestedGroup = CRM_Core_PseudoConstant::nestedGroup(TRUE, 'Mailing');
-    $this->assertSame([$group1->id => 'Parent Group A'], $nestedGroup);
+    $this->assertSame([
+      $group1->id => 'Parent Group A',
+      $group3->id => '  Child Group C',
+    ], $nestedGroup);
   }
 
   /**