]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - vendor/pimple/pimple/ext/pimple/tests/016.phpt
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / pimple / pimple / ext / pimple / tests / 016.phpt
diff --git a/vendor/pimple/pimple/ext/pimple/tests/016.phpt b/vendor/pimple/pimple/ext/pimple/tests/016.phpt
new file mode 100644 (file)
index 0000000..e55edb0
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Test extend()
+--SKIPIF--
+<?php if (!extension_loaded("pimple")) print "skip"; ?>
+--FILE--
+<?php
+/*
+ This is part of Pimple::extend() code :
+
+          $extended = function ($c) use ($callable, $factory) {
+             return $callable($factory($c), $c);
+          };
+*/
+
+$p = new Pimple\Container();
+$p[12] = function ($v) { var_dump($v); return 'foo';}; /* $factory in code above */
+
+$c = $p->extend(12, function ($w) { var_dump($w); return 'bar'; }); /* $callable in code above */
+
+var_dump($c('param'));
+--EXPECTF--
+string(5) "param"
+string(3) "foo"
+string(3) "bar"
\ No newline at end of file