aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/php/abstract_inherit_runme.php
blob: 376a2adaacb6fcb1b586fb7d9c0f70e7d4034016 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

require "tests.php";

check::classes(array('Foo','Bar','Spam','NRFilter_i','NRRCFilter_i','NRRCFilterpro_i','NRRCFilterpri_i'));

// 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();