Skip to content

Commit

Permalink
Merge branch '2024.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlabci committed Dec 10, 2024
2 parents f691d5b + 2857667 commit 37403f7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/tine20/GDPR/Controller/DataIntendedPurposeRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,27 @@ public function testPublicApiGetManageConsent()
$createdContact = Addressbook_Controller_Contact::getInstance()->create($contact);
$response = GDPR_Controller_DataIntendedPurposeRecord::getInstance()->publicApiGetManageConsent($createdContact->getId());
$responseData = json_decode($response->getBody(), true);
static::assertEquals(2, sizeof($responseData['allDataIntendedPurposes']), 'expect to find 2 data intended purpose records for this contact');
$dipCount = $responseData['allDataIntendedPurposes'];

$filter = Tinebase_Model_Filter_FilterGroup::getFilterForModel(GDPR_Model_DataIntendedPurpose::class, [
['field' => GDPR_Model_DataIntendedPurpose::FLD_IS_SELF_SERVICE, 'operator' => 'equals', 'value' => false]
]);
$allDips = GDPR_Controller_DataIntendedPurpose::getInstance()->search($filter);
$expander = new Tinebase_Record_Expander(GDPR_Model_DataIntendedPurpose::class, [
Tinebase_Record_Expander::EXPANDER_PROPERTIES => [
GDPR_Model_DataIntendedPurpose::FLD_NAME => [],
GDPR_Model_DataIntendedPurpose::FLD_DESCRIPTION => [],
],
]);
$expander->expand($allDips);
$dataIntendedPurpose = $allDips->getFirstRecord();
$dataIntendedPurpose[GDPR_Model_DataIntendedPurpose::FLD_IS_SELF_SERVICE] = true;
$dataIntendedPurpose = GDPR_Controller_DataIntendedPurpose::getInstance()->update($dataIntendedPurpose);

$response = GDPR_Controller_DataIntendedPurposeRecord::getInstance()->publicApiGetManageConsent($createdContact->getId());
$responseData = json_decode($response->getBody(), true);
$dipCountNew = $responseData['allDataIntendedPurposes'];

static::assertEquals(count($dipCount), count($dipCountNew) + 1, 'dip with self service enabled should not be shown');
}
}

0 comments on commit 37403f7

Please sign in to comment.