assert_basic.phpt 481 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. assert() - basic - check that assert runs when assert.active is set to 1.
  3. --INI--
  4. assert.active = 1
  5. assert.warning = 0
  6. assert.callback = f1
  7. assert.bail = 0
  8. assert.quiet_eval = 0
  9. --FILE--
  10. <?php
  11. function f1()
  12. {
  13. echo "f1 called\n";
  14. }
  15. //String assert
  16. $sa = "0 != 0";
  17. var_dump($r2=assert($sa));
  18. $sa = "0 == 0";
  19. var_dump($r2=assert($sa));
  20. //Non string assert
  21. var_dump($r2=assert(0));
  22. var_dump($r2=assert(1));
  23. --EXPECTF--
  24. f1 called
  25. NULL
  26. bool(true)
  27. f1 called
  28. NULL
  29. bool(true)