<?php
require "tests.php";
check::functions(array());
check::classes(array('Bar', 'Foo_integers'));
check::globals(array());
$barObj = new Bar();
$fooIntsObj = $barObj->meth();
check::equal(get_class($fooIntsObj), "Foo_integers", "wrong class");
check::equal($fooIntsObj->meth(42) , 42, "Foo_integers::meth(n) should return n");
class MyFooInts extends Foo_integers {
function meth($n) {
return $n + 1;
}
}
class MyBar extends Bar {
function meth() {
return new MyFooInts();
}
}
$barObj = new MyBar();
$fooIntsObj = $barObj->meth();
check::equal(get_class($fooIntsObj), "MyFooInts", "wrong class");
check::equal($fooIntsObj->meth(42) , 43, "MyFooInts::meth(n) should return n + 1");