"Fossies" - the Fresh Open Source Software Archive

Member "ILIAS-5.4.8/libs/composer/vendor/pimple/pimple/ext/pimple/tests/016.phpt" (22 Nov 2019, 577 Bytes) of package /linux/www/ILIAS-5.4.8.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    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 
   10           $extended = function ($c) use ($callable, $factory) {
   11              return $callable($factory($c), $c);
   12           };
   13 */
   14 
   15 $p = new Pimple\Container();
   16 $p[12] = function ($v) { var_dump($v); return 'foo';}; /* $factory in code above */
   17 
   18 $c = $p->extend(12, function ($w) { var_dump($w); return 'bar'; }); /* $callable in code above */
   19 
   20 var_dump($c('param'));
   21 --EXPECTF--
   22 string(5) "param"
   23 string(3) "foo"
   24 string(3) "bar"