Annotation of embedaddon/php/ext/spl/tests/spl_autoload_013.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: SPL: spl_autoload_functions() with closures and invokables
        !             3: --FILE--
        !             4: <?php
        !             5: $closure = function($class) {
        !             6:   echo "a called\n";
        !             7: };
        !             8: 
        !             9: class Autoloader {
        !            10:   private $dir;
        !            11:   public function __construct($dir) {
        !            12:     $this->dir = $dir;
        !            13:   }
        !            14:   public function __invoke($class) {
        !            15:     var_dump("{$this->dir}/$class.php");
        !            16:   }
        !            17: }
        !            18: 
        !            19: $al1 = new Autoloader('d1');
        !            20: $al2 = new Autoloader('d2');
        !            21: 
        !            22: spl_autoload_register($closure);
        !            23: spl_autoload_register($al1);
        !            24: spl_autoload_register($al2);
        !            25: 
        !            26: var_dump(spl_autoload_functions());
        !            27: 
        !            28: ?>
        !            29: ===DONE===
        !            30: --EXPECTF--
        !            31: array(3) {
        !            32:   [0]=>
        !            33:   object(Closure)#%d (1) {
        !            34:     ["parameter"]=>
        !            35:     array(1) {
        !            36:       ["$class"]=>
        !            37:       string(10) "<required>"
        !            38:     }
        !            39:   }
        !            40:   [1]=>
        !            41:   object(Autoloader)#%d (1) {
        !            42:     ["dir":"Autoloader":private]=>
        !            43:     string(2) "d1"
        !            44:   }
        !            45:   [2]=>
        !            46:   object(Autoloader)#%d (1) {
        !            47:     ["dir":"Autoloader":private]=>
        !            48:     string(2) "d2"
        !            49:   }
        !            50: }
        !            51: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>