First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
32
sites/all/modules/civicrm/Civi/CiUtil/CSVParser.php
Normal file
32
sites/all/modules/civicrm/Civi/CiUtil/CSVParser.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
namespace Civi\CiUtil;
|
||||
|
||||
/**
|
||||
* Parse phpunit result files
|
||||
*/
|
||||
class CSVParser {
|
||||
|
||||
/**
|
||||
* @param string $csvContent
|
||||
* Content; each row in the row csv should start with two cells:.
|
||||
* - cell 0: the test name
|
||||
* - cell 1: the test status
|
||||
* @return array
|
||||
* (string $testName => string $status)
|
||||
*/
|
||||
public static function parseResults($csvContent) {
|
||||
$fh = fopen('php://memory', 'r+');
|
||||
fwrite($fh, $csvContent);
|
||||
rewind($fh);
|
||||
|
||||
$results = array();
|
||||
while (($r = fgetcsv($fh)) !== FALSE) {
|
||||
$name = str_replace('.', '::', trim($r[0]));
|
||||
$status = trim($r[1]);
|
||||
$results[$name] = $status;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue