From 114ab0988e20ac6be39ad363ff897a1a3b85e565 Mon Sep 17 00:00:00 2001
From: Razican The expected result you supply can either be a literal match, or a data type match. Here's an example of a literal: The expected result you supply can either be a literal match, or a data type match. Here's an example of a literal: Notice the use of "is_string" in the second parameter? This tells the function to evaluate whether your test is producing a string
-as the result. Here is a list of allowed comparison types: Notice the use of "is_string" in the second parameter? This tells the function to evaluate whether your test is producing a string
+as the result. Here is a list of allowed comparison types:
$this->unit->run($test, $expected_result, $test_name);
-$this->unit->run('Foo', 'Foo');
@@ -100,8 +100,8 @@ $this->unit->run($test, $expected_result, $test_name);
$this->unit->run('Foo', 'is_string');
-
echo $this->unit->report();
-The report will be formatted in an HTML table for viewing. If you prefer the raw data you can retrieve an array using:
+The report will be formatted in an HTML table for viewing. If you prefer the raw data you can retrieve an array using:
echo $this->unit->result();
By default the unit test class evaluates literal matches loosely. Consider this example:
+By default the unit test class evaluates literal matches loosely. Consider this example:
$this->unit->run(1, TRUE);
-The test is evaluating an integer, but the expected result is a boolean. PHP, however, due to it's loose data-typing +
The test is evaluating an integer, but the expected result is a boolean. PHP, however, due to it's loose data-typing will evaluate the above code as TRUE using a normal equality test:
if (1 == TRUE) echo 'This evaluates as true';
@@ -184,8 +184,8 @@ You can customize which of these items get displayed by using $this->unit->
If you would like your test results formatted differently then the default you can set your own template. Here is an -example of a simple template. Note the required pseudo-variables:
+If you would like your test results formatted differently then the default you can set your own template. Here is an +example of a simple template. Note the required pseudo-variables:
$str = '
--
cgit v1.2.3-24-g4f1b