]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - vendor/pimple/pimple/ext/pimple/tests/010.phpt
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / pimple / pimple / ext / pimple / tests / 010.phpt
diff --git a/vendor/pimple/pimple/ext/pimple/tests/010.phpt b/vendor/pimple/pimple/ext/pimple/tests/010.phpt
new file mode 100644 (file)
index 0000000..badce01
--- /dev/null
@@ -0,0 +1,45 @@
+--TEST--
+Test service is called as callback for every callback type
+--SKIPIF--
+<?php if (!extension_loaded("pimple")) print "skip"; ?>
+--FILE--
+<?php
+function callme()
+{
+    return 'called';
+}
+
+$a = function() { return 'called'; };
+
+class Foo
+{
+    public static function bar()
+    {
+        return 'called';
+    }
+}
+$p = new Pimple\Container();
+$p['foo'] = 'callme';
+echo $p['foo'] . "\n";
+
+$p['bar'] = $a;
+echo $p['bar'] . "\n";
+
+$p['baz'] = "Foo::bar";
+echo $p['baz'] . "\n";
+
+$p['foobar'] = array('Foo', 'bar');
+var_dump($p['foobar']);
+
+?>
+--EXPECTF--
+callme
+called
+Foo::bar
+array(2) {
+  [0]=>
+  string(3) "Foo"
+  [1]=>
+  string(3) "bar"
+}
\ No newline at end of file