"Fossies" - the Fresh Open Source Software Archive

Member "4.6.1/composer/pimple/pimple/ext/pimple/tests/010.phpt" (8 Apr 2021, 645 Bytes) of package /linux/www/studip-4.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 --TEST--
    2 Test service is called as callback for every callback type
    3 --SKIPIF--
    4 <?php if (!extension_loaded("pimple")) print "skip"; ?>
    5 --FILE--
    6 <?php
    7 function callme()
    8 {
    9     return 'called';
   10 }
   11 
   12 $a = function() { return 'called'; };
   13 
   14 class Foo
   15 {
   16     public static function bar()
   17     {
   18         return 'called';
   19     }
   20 }
   21  
   22 $p = new Pimple\Container();
   23 $p['foo'] = 'callme';
   24 echo $p['foo'] . "\n";
   25 
   26 $p['bar'] = $a;
   27 echo $p['bar'] . "\n";
   28 
   29 $p['baz'] = "Foo::bar";
   30 echo $p['baz'] . "\n";
   31 
   32 $p['foobar'] = array('Foo', 'bar');
   33 var_dump($p['foobar']);
   34 
   35 ?>
   36 --EXPECTF--
   37 callme
   38 called
   39 Foo::bar
   40 array(2) {
   41   [0]=>
   42   string(3) "Foo"
   43   [1]=>
   44   string(3) "bar"
   45 }