You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
507 B

8 years ago
  1. --TEST--
  2. Test service factory
  3. --SKIPIF--
  4. <?php if (!extension_loaded("pimple")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. $p = new Pimple\Container();
  8. $p->factory($f = function() { var_dump('called-1'); return 'ret-1';});
  9. $p[] = $f;
  10. $p[] = function () { var_dump('called-2'); return 'ret-2'; };
  11. var_dump($p[0]);
  12. var_dump($p[0]);
  13. var_dump($p[1]);
  14. var_dump($p[1]);
  15. ?>
  16. --EXPECTF--
  17. string(8) "called-1"
  18. string(5) "ret-1"
  19. string(8) "called-1"
  20. string(5) "ret-1"
  21. string(8) "called-2"
  22. string(5) "ret-2"
  23. string(5) "ret-2"