aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/php/abstract_inherit_runme.php
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/php/abstract_inherit_runme.php')
-rw-r--r--Examples/test-suite/php/abstract_inherit_runme.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/Examples/test-suite/php/abstract_inherit_runme.php b/Examples/test-suite/php/abstract_inherit_runme.php
index 514bbc3b0..376a2adaa 100644
--- a/Examples/test-suite/php/abstract_inherit_runme.php
+++ b/Examples/test-suite/php/abstract_inherit_runme.php
@@ -1,14 +1,19 @@
<?php
require "tests.php";
-require "abstract_inherit.php";
check::classes(array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i'));
-// This constructor attempt should fail as there isn't one
-//$spam=new Spam();
-//check::equal(0,$spam->blah(),"spam object method");
-//check::equal(0,Spam::blah($spam),"spam class method");
+// We shouldn't be able to instantiate any of these classes since they are all
+// abstract (in each case there's a pure virtual function in the base class
+// which isn't implemented).
+foreach (array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i')as $class) {
+ try {
+ $obj = eval("new $class();");
+ check::fail("Should not be able to instantiate abstract class $class");
+ } catch (Error $e) {
+ check::equal($e->getMessage(), "Cannot instantiate abstract class $class", "Unexpected exception: {$e->getMessage()}");
+ }
+}
check::done();
-?>