private static function renderCsv($actionName, $source)
 {
     HttpUtil::sendDownloadHeaders($actionName . '.csv', 'text/csv');
     $rows = $source->getRows();
     if (count($rows) > 0) {
         $keys = array_keys($rows[0]);
         self::pruneKeys($keys);
         echo afOutput::asCsv($keys);
         foreach ($rows as $row) {
             echo afOutput::asCsv(self::extractValues($row, $keys));
         }
     }
     exit;
 }
<?php

include dirname(__FILE__) . '/../bootstrap/dbunit.php';
$t = new lime_test(4, new lime_output_color());
$rows = array(array(1997, 'Ford', 'E350', 'ac, abs, moon', 3000.0), array(1999, 'Chevy', 'Venture "Extended Edition"', '', 4900.0), array(1999, 'Chevy', 'Venture "Extended Edition, Very Large"', '', 5000.0), array(1996, 'Jeep', 'Grand Cherokee', 'MUST SELL!
    air, moon roof, loaded', 4799.0));
$expected = array('"1997","Ford","E350","ac, abs, moon","3000"' . "\n", '"1999","Chevy","Venture ""Extended Edition""","","4900"' . "\n", '"1999","Chevy","Venture ""Extended Edition, Very Large""","","5000"' . "\n", '"1996","Jeep","Grand Cherokee","MUST SELL!
    air, moon roof, loaded","4799"' . "\n");
for ($i = 0; $i < count($rows); $i++) {
    $t->is(afOutput::asCsv($rows[$i]), $expected[$i]);
}