Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC/Unit Test] Fix passing test that should pass but also should fail #19607

Merged
merged 1 commit into from
Feb 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/phpunit/CRM/Case/BAO/CaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ private function assertCasesOfUser($loggedInUser, $caseId, $caseCount) {
$caseRoles = CRM_Case_BAO_Case::getCaseRoles($loggedInUser, $caseId);

$this->assertEquals($caseCount, $upcomingCases, 'Upcoming case count must be ' . $caseCount);
$this->assertEquals($caseCount, $summary['rows']['Housing Support']['Ongoing']['count'], 'Housing Support Ongoing case summary must be ' . $caseCount);
if ($caseCount === 0) {
// If there really are 0 cases then there won't be any subelements for
// status and count, so we get a false error if we use the assertEquals
// check since it tries to get a subelement on type int. In this case
// the summary rows are just the case type pseudoconstant list.
$this->assertSame(array_flip(CRM_Case_PseudoConstant::caseType()), $summary['rows']);
}
else {
$this->assertEquals($caseCount, $summary['rows']['Housing Support']['Ongoing']['count'], 'Housing Support Ongoing case summary must be ' . $caseCount);
}
$this->assertEquals($caseCount, count($caseRoles), 'Total case roles for logged in users must be ' . $caseCount);
}

Expand Down