diff options
Diffstat (limited to 'tests/dataset_test.php')
-rw-r--r-- | tests/dataset_test.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/dataset_test.php b/tests/dataset_test.php index 143a31c..850e3ab 100644 --- a/tests/dataset_test.php +++ b/tests/dataset_test.php @@ -255,16 +255,36 @@ class ezcGraphDataSetTest extends ezcTestCase ); } - public function testDataSetSetSingleData() + public function testIteratorToDataSet() { $chart = new ezcGraphPieChart(); - $chart->data['income'] = new ezcGraphArrayDataSet( array( 2000 => 2345.2, 2456.3, 2567.4 ) ); + $chart->data['income'] = new ezcGraphArrayDataSet( new ArrayIterator( array( 2000 => 2345.2, 2456.3, 2567.4 ) ) ); $chart->data['income'][2005] = 234.21; $this->assertSame( 234.21, $chart->data['income'][2005] ); + + $this->assertSame( + 2456.3, + $chart->data['income'][2001] + ); + } + + public function testDataSetInvalidDataSource() + { + $chart = new ezcGraphPieChart(); + try + { + $chart->data['income'] = new ezcGraphArrayDataSet( $chart ); + } + catch ( ezcGraphInvalidArrayDataSourceException $e ) + { + return true; + } + + $this->fail( 'Expected ezcGraphInvalidArrayDataSourceException.' ); } } ?> |