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.

23 lines
577 B

8 years ago
  1. --TEST--
  2. Test extend()
  3. --SKIPIF--
  4. <?php if (!extension_loaded("pimple")) print "skip"; ?>
  5. --FILE--
  6. <?php
  7. /*
  8. This is part of Pimple::extend() code :
  9. $extended = function ($c) use ($callable, $factory) {
  10. return $callable($factory($c), $c);
  11. };
  12. */
  13. $p = new Pimple\Container();
  14. $p[12] = function ($v) { var_dump($v); return 'foo';}; /* $factory in code above */
  15. $c = $p->extend(12, function ($w) { var_dump($w); return 'bar'; }); /* $callable in code above */
  16. var_dump($c('param'));
  17. --EXPECTF--
  18. string(5) "param"
  19. string(3) "foo"
  20. string(3) "bar"