Welcome to mirror list, hosted at ThFree Co, Russian Federation.

016.phpt « tests « pimple « ext « pimple « pimple « vendor « server - github.com/nextcloud/lookup-server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e55edb0a7a1310e2386c1b11356e9c62742e4fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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"