[php] Add runme.php for two more testcases
This commit is contained in:
parent
6254de05ef
commit
a1b45a8333
2 changed files with 49 additions and 0 deletions
26
Examples/test-suite/php/director_exception_catches_runme.php
Normal file
26
Examples/test-suite/php/director_exception_catches_runme.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
require "tests.php";
|
||||
|
||||
// No new functions
|
||||
check::functions(array());
|
||||
// New classes
|
||||
check::classes(array('BaseClass'));
|
||||
// No new vars
|
||||
check::globals(array());
|
||||
|
||||
class MyClass extends BaseClass {
|
||||
function description() {
|
||||
throw new Exception("Testing exception thrown in description()");
|
||||
}
|
||||
}
|
||||
|
||||
$b = new MyClass();
|
||||
try {
|
||||
BaseClass::call_description($b);
|
||||
check::fail("No exception thrown by BaseClass::call_description(\$b)");
|
||||
} catch (Exception $e) {
|
||||
check::equal($e->getMessage(), "Testing exception thrown in description()", "Unexpected exception message: ".$e->getMessage());
|
||||
}
|
||||
|
||||
check::done();
|
||||
23
Examples/test-suite/php/director_exception_nothrow_runme.php
Normal file
23
Examples/test-suite/php/director_exception_nothrow_runme.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
require "tests.php";
|
||||
|
||||
// No new functions
|
||||
check::functions(array());
|
||||
// New classes
|
||||
check::classes(array('Bar', 'Base'));
|
||||
// No new vars
|
||||
check::globals(array());
|
||||
|
||||
class MyBar extends Bar {
|
||||
function pang() {
|
||||
return "MyBar::pang()";
|
||||
}
|
||||
}
|
||||
|
||||
$a = new MyBar();
|
||||
check::equal($a->pang(), "MyBar::pang()", "MyBar::pang() not called as expected");
|
||||
$b = new Bar();
|
||||
check::equal($b->pang(), "Bar::pang()", "Bar::pang() not called as expected");
|
||||
|
||||
check::done();
|
||||
Loading…
Add table
Add a link
Reference in a new issue