summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions/ob_start_closures.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/general_functions/ob_start_closures.phpt')
-rw-r--r--ext/standard/tests/general_functions/ob_start_closures.phpt39
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/standard/tests/general_functions/ob_start_closures.phpt b/ext/standard/tests/general_functions/ob_start_closures.phpt
new file mode 100644
index 0000000..ba73096
--- /dev/null
+++ b/ext/standard/tests/general_functions/ob_start_closures.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test ob_start() function : closures as output handlers
+--INI--
+output_buffering=0
+--FILE--
+<?php
+echo "*** Testing ob_start() : closures as output handlers ***\n";
+
+ob_start(function ($output) {
+ return 'Output (1): ' . $output;
+});
+
+ob_start(function ($output) {
+ return 'Output (2): ' . $output;
+});
+
+echo "Test\nWith newlines\n";
+
+$str1 = ob_get_contents ();
+
+ob_end_flush();
+
+$str2 = ob_get_contents ();
+
+ob_end_flush();
+
+echo $str1, $str2;
+
+?>
+===DONE===
+--EXPECT--
+*** Testing ob_start() : closures as output handlers ***
+Output (1): Output (2): Test
+With newlines
+Test
+With newlines
+Output (2): Test
+With newlines
+===DONE===