diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-11-02 16:05:45 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-11-02 16:05:45 +0000 |
commit | 5bdf51ead2a5e1dfb683c56df48e3d887e743472 (patch) | |
tree | 7e39889aca43eff30617df44f5bb567be94035f9 /tests/driver_options_test.php | |
parent | 39d55ef60b9074920a1a3fc3d0c0f8d51f303760 (diff) | |
download | zetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.zip zetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.tar.gz |
- Throw ezcBaseValueExceptions instead of typecasting
- Do range checks instead of converting numbers using min and max
- Extended testcases to test for ezcBaseValueExceptions
Diffstat (limited to 'tests/driver_options_test.php')
-rw-r--r-- | tests/driver_options_test.php | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/tests/driver_options_test.php b/tests/driver_options_test.php index e2dcbd8..dd4660e 100644 --- a/tests/driver_options_test.php +++ b/tests/driver_options_test.php @@ -28,7 +28,7 @@ class ezcGraphDriverOptionsTest extends ezcImageTestCase $options = new ezcGraphSvgDriverOptions(); $this->assertSame( - false, + null, $options->width, 'Wrong default value for property width in class ezcGraphSvgDriverOptions' ); @@ -39,6 +39,17 @@ class ezcGraphDriverOptionsTest extends ezcImageTestCase $options->width, 'Setting property value did not work for property width in class ezcGraphSvgDriverOptions' ); + + try + { + $options->width = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); } public function testDriverOptionsPropertyHeight() @@ -46,7 +57,7 @@ class ezcGraphDriverOptionsTest extends ezcImageTestCase $options = new ezcGraphSvgDriverOptions(); $this->assertSame( - false, + null, $options->height, 'Wrong default value for property height in class ezcGraphSvgDriverOptions' ); @@ -57,6 +68,17 @@ class ezcGraphDriverOptionsTest extends ezcImageTestCase $options->height, 'Setting property value did not work for property height in class ezcGraphSvgDriverOptions' ); + + try + { + $options->height = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); } public function testDriverOptionsPropertyShadeCircularArc() @@ -75,6 +97,17 @@ class ezcGraphDriverOptionsTest extends ezcImageTestCase $options->shadeCircularArc, 'Setting property value did not work for property shadeCircularArc in class ezcGraphSvgDriverOptions' ); + + try + { + $options->shadeCircularArc = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); } public function testDriverOptionsPropertyLineSpacing() @@ -93,6 +126,17 @@ class ezcGraphDriverOptionsTest extends ezcImageTestCase $options->lineSpacing, 'Setting property value did not work for property lineSpacing in class ezcGraphSvgDriverOptions' ); + + try + { + $options->lineSpacing = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); } public function testDriverOptionsPropertyFont() |