[REF][PHP8.2] Use const instead of dynamic property api_v3_CaseTypeTest
authorBradley Taylor <hello@brad-taylor.co.uk>
Fri, 13 Jan 2023 20:04:59 +0000 (20:04 +0000)
committerBradley Taylor <hello@brad-taylor.co.uk>
Fri, 13 Jan 2023 20:04:59 +0000 (20:04 +0000)
tests/phpunit/api/v3/CaseTypeTest.php

index 5421b1f47ead01db4125b6325f991e5137b45b7b..8a67826846b0265dedf3adc6e6795ce6f9c3ec22 100644 (file)
  */
 class api_v3_CaseTypeTest extends CiviCaseTestCase {
 
-  public function setUp(): void {
-    $this->quickCleanup(['civicrm_case_type']);
-    parent::setUp();
-
-    $this->fixtures['Application_with_Definition'] = [
-      'title' => 'Application with Definition',
-      'name' => 'Application_with_Definition',
-      'is_active' => 1,
-      'weight' => 4,
-      'definition' => [
-        'activityTypes' => [
-          ['name' => 'First act'],
-        ],
-        'activitySets' => [
-          [
-            'name' => 'set1',
-            'label' => 'Label 1',
-            'timeline' => 1,
-            'activityTypes' => [
-              ['name' => 'Open Case', 'status' => 'Completed'],
-            ],
+  const APPLICATION_WITH_DEFINITION_PARAMS = [
+    'title' => 'Application with Definition',
+    'name' => 'Application_with_Definition',
+    'is_active' => 1,
+    'weight' => 4,
+    'definition' => [
+      'activityTypes' => [
+        ['name' => 'First act'],
+      ],
+      'activitySets' => [
+        [
+          'name' => 'set1',
+          'label' => 'Label 1',
+          'timeline' => 1,
+          'activityTypes' => [
+            ['name' => 'Open Case', 'status' => 'Completed'],
           ],
         ],
-        'timelineActivityTypes' => [
-          ['name' => 'Open Case', 'status' => 'Completed'],
-        ],
-        'caseRoles' => [
-          ['name' => 'First role', 'creator' => 1, 'manager' => 1],
-        ],
       ],
-    ];
+      'timelineActivityTypes' => [
+        ['name' => 'Open Case', 'status' => 'Completed'],
+      ],
+      'caseRoles' => [
+        ['name' => 'First role', 'creator' => 1, 'manager' => 1],
+      ],
+    ],
+  ];
+
+  public function setUp(): void {
+    $this->quickCleanup(['civicrm_case_type']);
+    parent::setUp();
   }
 
   /**
@@ -174,7 +174,7 @@ class api_v3_CaseTypeTest extends CiviCaseTestCase {
    */
   public function testCaseTypeCreateWithDefinition() {
     // Create Case Type
-    $params = $this->fixtures['Application_with_Definition'];
+    $params = self::APPLICATION_WITH_DEFINITION_PARAMS;
     $result = $this->callAPISuccess('CaseType', 'create', $params);
     $id = $result['id'];
 
@@ -193,7 +193,7 @@ class api_v3_CaseTypeTest extends CiviCaseTestCase {
    */
   public function testCaseTypeDelete_InUse() {
     // Create Case Type
-    $params = $this->fixtures['Application_with_Definition'];
+    $params = self::APPLICATION_WITH_DEFINITION_PARAMS;
     $createCaseType = $this->callAPISuccess('CaseType', 'create', $params);
 
     $createCase = $this->callAPISuccess('Case', 'create', [
@@ -244,7 +244,7 @@ class api_v3_CaseTypeTest extends CiviCaseTestCase {
   public function testDefinitionGroups() {
     $gid1 = $this->groupCreate(['name' => 'testDefinitionGroups1', 'title' => 'testDefinitionGroups1']);
     $gid2 = $this->groupCreate(['name' => 'testDefinitionGroups2', 'title' => 'testDefinitionGroups2']);
-    $def = $this->fixtures['Application_with_Definition'];
+    $def = self::APPLICATION_WITH_DEFINITION_PARAMS;
     $def['definition']['caseRoles'][] = [
       'name' => 'Second role',
       'groups' => ['testDefinitionGroups1', 'testDefinitionGroups2'],