Skip to content
Snippets Groups Projects
Commit a725aa6d authored by deepak-srivastava's avatar deepak-srivastava
Browse files

Merge pull request #942 from deepak-srivastava/hr

CRM-12622, filters and more valid assertions
parents 914329f0 ec24e302
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,10 @@ class CRM_Report_Form_Contribute_DetailTest extends CiviReportTestCase {
'email',
'total_amount',
),
'filters' => array(
'total_amount_op' => 'gte',
'total_amount_value' => 50,
),
// FIXME: add filters
),
'fixtures/dataset.sql',
......@@ -82,7 +86,9 @@ class CRM_Report_Form_Contribute_DetailTest extends CiviReportTestCase {
$expectedOutputCsvArray = $this->getArrayFromCsv(dirname(__FILE__) . "/{$expectedOutputCsvFile}");
$this->assertEquals(count($reportCsvArray[0]), count($expectedOutputCsvArray[0]), 'In line ' . __LINE__);
$this->compareCsvFiles($reportCsvFile, dirname(__FILE__) . "/{$expectedOutputCsvFile}");
// FIXME: add more asserts
foreach($reportCsvArray as $intKey => $strVal) {
$this->assertNotNull($expectedOutputCsvArray[$intKey], 'In line ' . __LINE__);
$this->assertEquals($expectedOutputCsvArray[$intKey], $strVal);
}
}
}
"Donor Name","First Name","Donor Email","Amount"
" Empowerment Association", , ,"$ 50.00"
"Bachman, Lincoln","Lincoln", ,"$ 175.00"
"Blackwell, Sanford","Sanford","st.blackwell3@testmail.co.pl","$ 250.00"
"Dimitrov, Iris","Iris","irisdimitrov@infomail.co.pl","$ 25.00"
"Dimitrov, Kenny","Kenny", ,"$ 50.00"
"Grant, Megan","Megan","grantm@fishmail.net","$ 500.00"
"merriechowski95@notmail.info", ,"merrie@testmail.co.nz","$ 125.00"
"Müller, Billy","Billy","mller.billy30@example.org","$ 50.00"
"Reynolds, Brent","Brent", ,"$ 10.00"
"Smith, Errol","Errol","errols@sample.com","$ 500.00"
" Empowerment Association", , ,"USD 50.00"
"Bachman, Lincoln","Lincoln", ,"USD 175.00"
"Blackwell, Sanford","Sanford","st.blackwell3@testmail.co.pl","USD 250.00"
"Dimitrov, Kenny","Kenny", ,"USD 50.00"
"Grant, Megan","Megan","grantm@fishmail.net","USD 500.00"
"merriechowski95@notmail.info", ,"merrie@testmail.co.nz","USD 125.00"
"Müller, Billy","Billy","mller.billy30@example.org","USD 50.00"
"Smith, Errol","Errol","errols@sample.com","USD 500.00"
......@@ -43,7 +43,11 @@ class CiviReportTestCase extends CiviUnitTestCase {
$_GET['fld'] = $fields;
$_GET['ufld'] = 1;
}
if (!empty($inputParams['filters'])) {
foreach ($inputParams['filters'] as $key => $val) {
$_GET[$key] = $val;
}
}
$reportObj->storeResultSet();
$reportObj->buildForm();
$rows = $reportObj->getResultSet();
......@@ -65,21 +69,4 @@ class CiviReportTestCase extends CiviUnitTestCase {
}
return $arrFile;
}
function compareCsvFiles($csvFile1, $csvFile2) {
$arrFile1 = $this->getArrayFromCsv($csvFile1);
$arrFile2 = $this->getArrayFromCsv($csvFile2);
$intRow = 0;
foreach($arrFile1 as $intKey => $strVal) {
if (count($strVal) != count($arrFile2[$intKey])) {
//FIXME : exit("Column count doesn't match\n");
}
if (!isset($arrFile2[$intKey]) || ($arrFile2[$intKey] != $strVal)) {
//FIXME: exit("Column $intKey, row $intRow of $strFile1 doesn't match\n");
}
$intRow++;
}
// FIXME: print "All rows match fine.\n";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment