phpcheck.democheckmethods.php Total: 23 Tests, 11 Errors ->first, ↻all
PHPCheck V1.66, OS: Linux, Machine: el8_10.x86_64, PHP-Version: 8.2.28 (64 Bit), Time: 0.016 ms (AVG: 0.001 ms), Memory: 2.0M (512M)
CommentLineCodeResultTest
check test ok 20 $result 15;
$testResult = ($result === 15);
$t->check($result$testResult); 
[0.001 ms]
15
Ok
check test Error 25 $result 100;
$testResult = ($result === 3.25);
$t->check($result$testResult); 
[0.001 ms]
100
Error
checkEqual test ok, result is int 30 $result 15;
$expected 15;
$t->checkEqual($result$expected); 
[0.001 ms]
15
Ok
checkEqual test ok, result is array 35 $result = [1,2];
$expected = [1,2];
$t->checkEqual($result$expected); 
[0.001 ms]
array ( 0 => 1, 1 => 2, )
Ok
checkEqual Error, result is a string, not float 40 $result "3.25";
$expected 3.25;
$t->checkEqual($result$expected); 
[0.001 ms]
'3.25'
Error
checkNotEqual test ok 45 $result 3.25;
$notExpected null;
$t->checkNotEqual($result$notExpected); 
[0.000 ms]
3.25
Ok
checkNotEqual test Error 50 $result null;
$notExpected null;
$t->checkNotEqual($result$notExpected); 
[0.001 ms]
NULL
Error
checkEqualHex test ok 55 //If the result is a string, 
//it will be displayed as a hex string
$result "\xf1\x23" "\x7f\xff";
$expected "\x71\x23";
$t->checkEqualHex($result$expected); 
[0.001 ms]
'71 23'
Ok
checkEqualHex test Error 62 $result "test\n";
$expected "test\r\n";
$t->checkEqualHex($result$expected); 
[0.000 ms]
'74 65 73 74 0A'
Error
checkContains test ok 67 //The test is ok if the elements of the list
//are present in the order in the string 
$result "A B CDE F";
$contains "A,CD";
$t->checkContains($result$contains); 
[0.000 ms]
'A B CDE F'
Ok
checkContains test Error 74 $result "A B C D E F";
$contains "A,CD";
$t->checkContains($result$contains); 
[0.001 ms]
'A B C D E F'
Error
checkHTML test ok 79 //ok if the string is valid html
$result "<td class='c1'>123</td>";
$t->checkHTML($result); 
[0.001 ms]
'<td class=\'c1\'>123</td>'
Ok
checkHTML test Error invalid HTML 84 $result "<td class='c1'>123</tr>";
$t->checkHTML($result); 
User Warning: Ln:1 - Unexpected end tag : tr (phpcheck.php line 230)
[0.001 ms]
'<td class=\'c1\'>123</tr>'
Error
checkHTML test ok 88 //ok if the string is valid html
//and contains all elements of list
$result "<td class='c1'>123</td>";
$contains "<td,class,c1,</td>";
$t->checkHTML($result$contains); 
[0.000 ms]
'<td class=\'c1\'>123</td>'
Ok
checkHTML test Error: class not c1 95 $result "<td class='other'>123</td>";
$contains "<td,class,c1,</td>";
$t->checkHTML($result$contains); 
[0.000 ms]
'<td class=\'other\'>123</td>'
Error
checkOutput ok 100 //startOutput used
echo 'Hello world';
$t->checkOutput('Hello world'); 
[0.001 ms]
'Hello world'
Ok
checkOutput Error 105 //startOutput used
echo 'Hello my world';
$t->checkOutput('Hello world'); 
[0.000 ms]
'Hello my world'
Error
check Exception: ok 110 //the code that throws an exception 
//must be wrapped in a function
$checkFct = function(){
  throw new 
Exception;
};
$t->checkException($checkFct); 
[0.001 ms]
'Exception: Exception ""'
Ok
check Exception: Error 118 $checkFct = function(){
  
//do nothing
};
$t->checkException($checkFct); 
[0.001 ms]
''
Error
check Exception and typ: ok 124 $checkFct = function(){
  throw new 
InvalidArgumentException;
};
$t->checkException($checkFct,'InvalidArgumentException'); 
[0.000 ms]
'Exception: InvalidArgumentException ""'
Ok
check Exception and typ: Error 130 $checkFct = function(){
  throw new 
InvalidArgumentException;
};
$t->checkException($checkFct,'MyException'); 
[0.001 ms]
'Exception: InvalidArgumentException ""'
Error
checkMultipletest ok 3 * 4 141 $expected 12;
$result myFunction(3,4); 
[0.002 ms]
12
Ok
checkMultipletest error 3 * 4 141 $expected 13;
$result myFunction(3,4); 
[0.000 ms]
12
Error