PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/php/threads_exception_runme.php

#
PHP | 43 lines | 33 code | 7 blank | 3 comment | 0 complexity | e501e6d3a6f50753fd400e42c1d35ab6 MD5 | raw file
 1<?php
 2
 3require "tests.php";
 4require "threads_exception.php";
 5
 6// Check functions
 7check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi));
 8// Check classes.
 9check::classes(array(Exc,Test));
10// Chek globals.
11check::globals(array(exc_code,exc_msg));
12
13$t = new Test();
14try {
15    $t->unknown();
16} catch (Exception $e) {
17    check::equal($e->getMessage(), 'C++ A * exception thrown', '');
18}
19
20try {
21    $t->simple();
22} catch (Exception $e) {
23    check::equal($e->getCode(), 37, '');
24}
25
26try {
27    $t->message();
28} catch (Exception $e) {
29    check::equal($e->getMessage(), 'I died.', '');
30}
31
32try {
33    $t->hosed();
34} catch (Exception $e) {
35    check::equal($e->getMessage(), 'C++ Exc exception thrown', '');
36}
37
38foreach (Array(1,2,3,4) as $i) {
39    try {
40	$t->multi($i);
41    } catch (Exception $e) {
42    }
43}