Annotation of embedaddon/php/tests/output/ob_get_contents_basic_001.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test ob_get_contents() function : basic functionality
3: --CREDITS--
4: Iain Lewis <ilewis@php.net>
5: --FILE--
6: <?php
7: /* Prototype : proto string ob_get_contents(void)
8: * Description: Return the contents of the output buffer
9: * Source code: main/output.c
10: * Alias to functions:
11: */
12:
13:
14: echo "*** Testing ob_get_contents() : basic functionality ***\n";
15:
16: // Zero arguments
17: echo "\n-- Testing ob_get_contents() function with Zero arguments --\n";
18: /* Buffering not started yet, should return false */
19: var_dump( ob_get_contents() );
20:
21: ob_start();
22: echo "Hello World\n";
23: $hello = ob_get_contents();
24: var_dump($hello);
25: ob_end_flush();
26:
27:
28: echo "\ncheck that we dont have a reference\n";
29: ob_start();
30: echo "Hello World\n";
31: $hello2 = ob_get_contents();
32: $hello2 = "bob";
33: var_dump(ob_get_contents());
34: ob_end_flush();
35:
36: echo "\ncheck that contents disappear after a flush\n";
37: ob_start();
38: echo "Hello World\n";
39: ob_flush();
40: var_dump(ob_get_contents());
41: ob_end_flush();
42:
43: echo "\ncheck that no contents found after an end\n";
44: ob_start();
45: echo "Hello World\n";
46: ob_end_flush();
47: var_dump(ob_get_contents());
48:
49:
50: echo "Done\n";
51: ?>
52: --EXPECTF--
53: *** Testing ob_get_contents() : basic functionality ***
54:
55: -- Testing ob_get_contents() function with Zero arguments --
56: bool(false)
57: Hello World
58: string(12) "Hello World
59: "
60:
61: check that we dont have a reference
62: Hello World
63: string(12) "Hello World
64: "
65:
66: check that contents disappear after a flush
67: Hello World
68: string(0) ""
69:
70: check that no contents found after an end
71: Hello World
72: bool(false)
73: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>