summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-11-27 12:08:07 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-11-27 12:08:07 +0000
commit97fbff9cc4dbaece41a60bf63f4876ba030eef25 (patch)
tree43b20beedfec7ec190e111793ebbf2c98d412999
parentf130ab5cb1155a0cda8725cbd1a52f7527acfada (diff)
downloadzetacomponents-graph-97fbff9cc4dbaece41a60bf63f4876ba030eef25.zip
zetacomponents-graph-97fbff9cc4dbaece41a60bf63f4876ba030eef25.tar.gz
- Test for drivers __set-method
-rw-r--r--src/interfaces/driver.php2
-rw-r--r--tests/driver_options_test.php45
2 files changed, 47 insertions, 0 deletions
diff --git a/src/interfaces/driver.php b/src/interfaces/driver.php
index d325656..5c2f180 100644
--- a/src/interfaces/driver.php
+++ b/src/interfaces/driver.php
@@ -55,6 +55,8 @@ abstract class ezcGraphDriver
{
throw new ezcBaseValueException( "options", $propertyValue, "instanceof ezcGraphOptions" );
}
+ break;
+
default:
throw new ezcBasePropertyNotFoundException( $propertyName );
break;
diff --git a/tests/driver_options_test.php b/tests/driver_options_test.php
index 6dfb956..2e3b2a1 100644
--- a/tests/driver_options_test.php
+++ b/tests/driver_options_test.php
@@ -23,6 +23,51 @@ class ezcGraphDriverOptionsTest extends ezcTestImageCase
return new PHPUnit_Framework_TestSuite( "ezcGraphDriverOptionsTest" );
}
+ public function testDriverOptionsProperty()
+ {
+ $driver = new ezcGraphSvgDriver();
+
+ $this->assertEquals(
+ new ezcGraphSvgDriverOptions(),
+ $driver->options,
+ 'Wrong default value for property options in class ezcGraphSvgDriver'
+ );
+
+ $driver->options = new ezcGraphFlashDriverOptions();
+ $this->assertEquals(
+ new ezcGraphFlashDriverOptions(),
+ $driver->options,
+ 'Setting property value did not work for property options in class ezcGraphSvgDriver'
+ );
+
+ try
+ {
+ $driver->options = false;
+ }
+ catch ( ezcBaseValueException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcBaseValueException.' );
+ }
+
+ public function testDriverUnknownProperty()
+ {
+ $driver = new ezcGraphSvgDriver();
+
+ try
+ {
+ $driver->unknownProperty = false;
+ }
+ catch ( ezcBasePropertyNotFoundException $e )
+ {
+ return true;
+ }
+
+ $this->fail( 'Expected ezcBasePropertyNotFoundException.' );
+ }
+
public function testDriverOptionsPropertyWidth()
{
$options = new ezcGraphSvgDriverOptions();
OpenPOWER on IntegriCloud