check phpcheck Instance |
17 |
// $t = new PHPcheck $t->setOutputVariant("Form"); // put all Test's in a form and create // a Button "Send Elements as POST" $t->check($t instanceof phpcheck, true);
|
[0.003 ms] true |
Ok |
check: ok, simple integer addition |
24 |
$result = 5 + 4; $expect = 9; $t->check($result, $result === $expect);
|
[0.001 ms] 9 |
Ok |
check: test that fails |
29 |
$result = 3 + 4; $expect = 9; $t->check($result, $result === $expect);
|
[0.001 ms] 7 |
Error |
checkEqual:ok, simple addition |
34 |
$result = 5 + 4; $expect = 9; $t->checkEqual($result, $expect);
|
[0.000 ms] 9 |
Ok |
checkEqual: Error |
39 |
$result = 5 + 4; $expect = "9"; //error: $result is a integer, string expect $t->checkEqual($result, $expect);
|
[0.000 ms] 9 |
Error |
checkEqual with Floats |
45 |
$result = 1/3; $expect = 0.33333333333333; //checkEqual compare Floats with DEFAULT_FLOAT_PRECISION = 14 $t->checkEqual($result, $expect);
|
[0.000 ms] 0.3333333333333333 |
Error |
checkEqual: Error |
51 |
$result = 1/3; //expect has insufficient precision $expect = 0.33333333; $t->checkEqual($result, $expect);
|
[0.000 ms] 0.3333333333333333 |
Error |
checkEqual: ok, compare with delta |
57 |
$result = 1/3; $expect = 0.33333333; $delta = 0.00000001; $t->checkEqual($result, $expect,"", $delta);
|
[0.000 ms] 0.3333333333333333 |
Ok |
checkEqualHex: ok |
63 |
//work how checkEqual, display result hexadezimal $result = "abc\n"; $expect = "abc\x0a"; $t->checkEqualHex($result, $expect);
|
[0.000 ms] '61 62 63 0A' |
Ok |
checkContains |
69 |
$result = "A123B56C"; //check if result contain '12' before '56' $t->checkContains($result,'12,56');
|
[0.001 ms] 'A123B56C' |
Ok |
checkHTML: ok |
74 |
//enable display results as html $t->setResultFilter("html"); $result = "<b>Fett</b>"; //check if result is valid HTML $t->checkHTML($result);
|
[0.001 ms] Fett |
Ok |
checkHTML with Contain: ok |
81 |
$result = "<b>Bold</b>"; $t->checkHTML($result, '<b>,Bo,</b>');
|
[0.000 ms] Bold |
Ok |
checkHTML: false, invalid HTML |
85 |
//default, escape html $t->setResultFilter(); $result = "<b>Fett"; //invalid HTML $t->checkHTML($result);
|
User Warning: Ln:1 - Opening and ending tag mismatch: body and b (phpcheck.php line 230) [0.000 ms] '<b>Fett' |
Error |
startOutput and checkOutput |
91 |
//$t->startOutput() //must use echo "A Message"; $t->checkOutput("A Message");
|
[0.001 ms] 'A Message' |
Ok |
startOutput and checkHTML |
96 |
//$t->startOutput() echo "<p>A Message</p>"; //first param is null result will get from output-buffer $t->checkHTML(null, "A Message");
|
[0.000 ms] '<p>A Message</p>' |
Ok |
Output a input text field1 |
102 |
$t->setResultFilter("html"); echo '<input name="field1" >'; $t->checkHTML(null);
|
[0.000 ms]
|
Ok |
Test 17 |
114 |
$expected = 20;
$result = \Closure::__set_state(array( ))(4,5);
|
[0.001 ms]
20 |
Ok |
Test 18 |
114 |
$expected = -10;
$result = \Closure::__set_state(array( ))(-2,5);
|
[0.000 ms]
-10 |
Ok |
check Exception |
117 |
//to test an exeption //the test must run in a closure $closure = function(){ throw new exception; }; $t->checkException($closure);
|
[0.000 ms] Exception: Exception "" |
Ok |
check $_POST |
126 |
$result = $_POST; $testOk = ( empty($_POST) //first Call OR isset($_POST["field1"]) //after Send Form ); $t->check($result, $testOk);
|
[0.001 ms]
array (
) |
Ok |