"Fossies" - the Fresh Open Source Software Archive

Member "4.6.1/composer/pimple/pimple/ext/pimple/tests/005.phpt" (8 Apr 2021, 427 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 simple class inheritance
    3 --SKIPIF--
    4 <?php if (!extension_loaded("pimple")) print "skip"; ?>
    5 --FILE--
    6 <?php 
    7 class MyPimple extends Pimple\Container
    8 {
    9     public $someAttr = 'fooAttr';
   10 
   11     public function offsetget($o)
   12     {
   13         var_dump("hit");
   14         return parent::offsetget($o);
   15     }
   16 }
   17 
   18 $p = new MyPimple;
   19 $p[42] = 'foo';
   20 echo $p[42];
   21 echo "\n";
   22 echo $p->someAttr;
   23 ?>
   24 --EXPECT--
   25 string(3) "hit"
   26 foo
   27 fooAttr