hiphop-php /hphp/test/slow/ext_output/ext_output.php

Language PHP Lines 92
MD5 Hash 48355ba4a51b25656da1d34bde9d9067 Estimated Cost $1,681 (why?)
Repository git://github.com/facebook/hiphop-php.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php

function mytolower($a) {
  return strtolower($a);
}

// don't print things here, since this tests what accumulates in the
// output buffer.
function VS($x, $y) {
  if ($x !== $y) {
    var_dump($x);
    var_dump($y);
    throw new Exception("test failed: got $x, expected $y");
  }
}

//////////////////////////////////////////////////////////////////////

ob_start();
ob_start("mytolower");
echo "TEst";
ob_end_flush();
VS(ob_get_clean(), "test");

ob_start();
echo "test";
ob_clean();
VS(ob_get_clean(), "");

ob_start();
ob_start("mytolower");
echo "TEst";
ob_flush();
VS(ob_get_clean(), "");
VS(ob_get_clean(), "test");

ob_start();
ob_start("mytolower");
echo "TEst";
ob_end_clean();
VS(ob_get_clean(), "");

ob_start();
ob_start("mytolower");
echo "TEst";
ob_end_flush();
VS(ob_get_clean(), "test");

ob_start();
ob_start();
echo "test";
VS(ob_get_clean(), "test");
VS(ob_get_clean(), "");
VS(ob_get_clean(), false);

ob_start();
echo "test";
VS(ob_get_contents(), "test");
VS(ob_get_contents(), "test"); // verifying content stays
ob_end_clean();

ob_start();
ob_start();
echo "test";
VS(ob_get_flush(), "test");
VS(ob_get_flush(), "test");
ob_end_clean();
VS(ob_get_flush(), false);
ob_end_clean();

ob_start();
echo "test";
VS(ob_get_length(), 4);
ob_end_clean();

VS(ob_get_level(), 0);
ob_start();
VS(ob_get_level(), 1);
ob_end_clean();
VS(ob_get_level(), 0);

ob_get_status();

ob_start();
ob_start("mytolower");
$handlers = ob_list_handlers();
ob_end_clean();
ob_end_clean();
VS($handlers, array("default output handler", "mytolower"));

echo "\nok\n";
Back to Top