예제 #1
0
$c1 = $q1->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
$d1 = array();
foreach ($c1 as $key => $value) {
    $d1[] = strtotime($value['date']);
}
$c2 = $q2->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
$d2 = array();
foreach ($c2 as $key => $value) {
    $d2[] = strtotime($value['date']);
}
$dates = array_unique(array_merge($d1, $d2));
sort($dates);
$g = new ChartSource();
$g->setSeries(array($s1, $s2));
$x_series = $g->getSeriesDataByColumn('date', 'datetime');
$x = $g->buildXAxisData($x_series);
$t->cmp_ok($x, '===', $dates, '->buildXAxisData() returns an array containing the unique values of all series data for the requestes column');
// buildXAxisDataByRangeTypeAndCalculationBase()
$t->diag('::buildXAxisDataByRangeTypeAndCalculationBase');
$rt = 'anything';
$bt = 'date';
$options = array();
try {
    $x = $g->buildXAxisDataByRangeTypeAndCalculationBase($rt, $bt, $options);
    $t->fail('no code should be executed after throwing an exception');
} catch (Exception $e) {
    $t->pass('->buildXAxisDataByRangeTypeAndCalculationBase() only accepts range types defined by ChartTable::getRangeTypes()');
}
$rt = 'date';
$bt = 'sdgsd';
$options = array();