forked from the-crucible/phpunit-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10OutoutBuffering.php
More file actions
37 lines (31 loc) · 964 Bytes
/
10OutoutBuffering.php
File metadata and controls
37 lines (31 loc) · 964 Bytes
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
<?php
/**
* This test checks for a function to echo something.
*/
class OutputTest extends PHPUnit_Framework_TestCase
{
public function testExpectFooActualFoo()
{
// This line will set the expectation that
// Which string is going to be echoed
$this->expectOutputString('foo');
$echo_str1 = "foo";
$echo_str2 = "baar";
$actual_echo_str = $echo_str2;
#$actual_echo_str = $echo_str1;
#Uncommenting line above will pass this test;
print $actual_echo_str;
}
}
/**
* Similar functions which test the output buffer but
* with different functionalities are below
*
* void expectOutputRegex(string $regularExpression)
* Set up the expectation that the output matches a $regularExpression.
*
* bool setOutputCallback(callable $callback)
* Sets up a callback that is used to check further that the output was expected or not
*
*/
?>