Skip to content
Snippets Groups Projects
Verified Commit ee5b1bdd authored by jaapjansma's avatar jaapjansma
Browse files

#5830 CaseType api (v4) returns empty definition


Update Civi/Api4/Utils/FormattingUtil.php

Co-authored-by: colemanw's avatarcolemanw <coleman@civicrm.org>

#5830 CaseType api (v4) returns empty definition
parent 300faa2b
Branches
No related tags found
No related merge requests found
......@@ -239,8 +239,8 @@ class FormattingUtil {
}
}
foreach ($result as $key => $value) {
// Skip null values or values that have already been unset by `formatOutputValue` functions
if (!isset($result[$key])) {
// Skip values that have already been unset by `formatOutputValue` functions
if (!array_key_exists($key, $result)) {
continue;
}
// Use ??= to only convert each column once
......
......@@ -23,6 +23,7 @@ use api\v4\Api4TestBase;
use Civi\API\Exception\UnauthorizedException;
use Civi\Api4\Activity;
use Civi\Api4\CaseActivity;
use Civi\Api4\CaseType;
use Civi\Api4\CiviCase;
use Civi\Api4\Relationship;
......@@ -114,6 +115,24 @@ class CaseTest extends Api4TestBase {
$this->assertEquals(['Closed', 'Testing'], $options);
}
public function testCaseTypeDefinition(): void {
$caseType = $this->createTestRecord('CaseType', [
'title' => 'Test Case Type',
'name' => 'test_case_type3',
'definition' => [
'statuses' => ['Testing', 'Closed'],
],
]);
$caseTypeToTest = CaseType::get(FALSE)
->addSelect('definition')
->addWhere('name', '=', 'test_case_type3')
->execute()
->first();
$this->assertArrayHasKey('definition', $caseTypeToTest);
$this->assertNotNull($caseTypeToTest['definition']);
}
public function testCaseActivity(): void {
$case1 = $this->createTestRecord('Case');
$case2 = $this->createTestRecord('Case');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment