PageRenderTime 41ms CodeModel.GetById 19ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. <?php
  2. require "tests.php";
  3. require "threads_exception.php";
  4. // Check functions
  5. check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi));
  6. // Check classes.
  7. check::classes(array(Exc,Test));
  8. // Chek globals.
  9. check::globals(array(exc_code,exc_msg));
  10. $t = new Test();
  11. try {
  12. $t->unknown();
  13. } catch (Exception $e) {
  14. check::equal($e->getMessage(), 'C++ A * exception thrown', '');
  15. }
  16. try {
  17. $t->simple();
  18. } catch (Exception $e) {
  19. check::equal($e->getCode(), 37, '');
  20. }
  21. try {
  22. $t->message();
  23. } catch (Exception $e) {
  24. check::equal($e->getMessage(), 'I died.', '');
  25. }
  26. try {
  27. $t->hosed();
  28. } catch (Exception $e) {
  29. check::equal($e->getMessage(), 'C++ Exc exception thrown', '');
  30. }
  31. foreach (Array(1,2,3,4) as $i) {
  32. try {
  33. $t->multi($i);
  34. } catch (Exception $e) {
  35. }
  36. }