assert.phpt 794 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. assert()
  3. --INI--
  4. assert.active = 0
  5. assert.warning = 1
  6. assert.callback =
  7. assert.bail = 0
  8. assert.exception=0
  9. --FILE--
  10. <?php
  11. function a($file, $line, $unused, $desc)
  12. {
  13. echo "assertion failed $line,\"$desc\"\n";
  14. }
  15. class a
  16. {
  17. static function assert($file, $line, $unused, $desc)
  18. {
  19. echo "class assertion failed $line,\"$desc\"\n";
  20. }
  21. }
  22. assert_options(ASSERT_ACTIVE,1);
  23. assert_options(ASSERT_WARNING,0);
  24. $a = 0;
  25. assert_options(ASSERT_CALLBACK,"a");
  26. assert($a != 0);
  27. assert_options(ASSERT_CALLBACK,array("a","assert"));
  28. assert($a != 0);
  29. $obj = new a();
  30. assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
  31. assert($a != 0);
  32. ?>
  33. --EXPECT--
  34. assertion failed 21,"assert($a != 0)"
  35. class assertion failed 24,"assert($a != 0)"
  36. class assertion failed 28,"assert($a != 0)"