$t->diag('->filterValuesSmallerThan()'); $data = array(1, 2, 3, 4, 5, 6, 7, 8); $cs = new ChartSource(); $keys = $cs->filterValuesSmallerThan($data, 5); $t->cmp_ok($keys, '===', array(4 => 5, 5 => 6, 6 => 7, 7 => 8), '::filterValuesSmallerThan() returns the elements of the input array whose value is larger than the given bound'); // ->filterValuesDifferentThan() $t->diag('->filterValuesDifferentThan()'); $data = array(1, 1.1, 0.9, 2, 3, 1, 1); $cs = new ChartSource(); $keys = $cs->filterValuesDifferentThan($data, 1); $t->cmp_ok($keys, '===', array(0 => 1, 5 => 1, 6 => 1), '::filterValuesDifferentThan() returns the elements of the input array whose value is equal than the given bound'); // ->filterValuesOutsideRange $t->diag('->filterValuesOutsideRange()'); $data = array(1, 2, 3, 4, 5, 6, 7, 1, 3, 4); $cs = new ChartSource(); $keys = $cs->filterValuesOutsideRange($data, 1, 4); $t->cmp_ok($keys, '===', array(0 => 1, 1 => 2, 2 => 3, 7 => 1, 8 => 3), '::filterValuesOutsideRange() returns the elements of the input array whose value is equal or larger than the lower bound and lower of the upper bound'); // ->buildXAxisData() $t->diag('->buildXAxisData()'); $q1 = Doctrine_Core::getTable('Charge')->createQuery('c')->select('c.*')->leftJoin('c.Category ct')->where('ct.Name = ?', 'Tax'); $q2 = Doctrine_Core::getTable('Charge')->createQuery('c')->select('c.*')->leftJoin('c.Category ct')->where('ct.Name = ?', 'Fuel'); $e1 = $q1->execute(); $e2 = $q2->execute(); $s1 = new ChartDataSerie(array('raw_data' => $e1, 'label' => 'Taxes', 'id' => 'tax')); $s2 = new ChartDataSerie(array('raw_data' => $e2, 'label' => 'Fuel', 'id' => 'fuel')); $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);