Skip to content

Commit 1d32be3

Browse files
committed
Testing CIUnitTestCase
1 parent a272fd9 commit 1d32be3

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

system/Test/CIUnitTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function assertCloseEnough(int $expected, $actual, string $message = '',
202202
* where the result is close but not exactly equal to the
203203
* expected time, for reasons beyond our control.
204204
*
205-
* @param integer $expected
205+
* @param mixed $expected
206206
* @param mixed $actual
207207
* @param string $message
208208
* @param integer $tolerance

tests/system/Test/TestCaseTest.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
class TestCaseTest extends \CIUnitTestCase
1010
{
1111

12+
// protected function tearDown()
13+
// {
14+
// $buffer = ob_clean();
15+
// if (ob_get_level() > 0)
16+
// {
17+
// ob_end_clean();
18+
// }
19+
// }
20+
//
1221
public function testGetPrivatePropertyWithObject()
1322
{
1423
$obj = new __TestForReflectionHelper();
@@ -86,9 +95,15 @@ public function testCloseEnough()
8695

8796
public function testCloseEnoughString()
8897
{
89-
$this->assertCloseEnough('1000', '0959');
90-
$this->assertCloseEnough('1000', '1000');
91-
$this->assertCloseEnough('1000', '1001');
98+
$this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('09:59:59'));
99+
$this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('10:00:00'));
100+
$this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('10:00:01'));
101+
}
102+
103+
public function testCloseEnoughStringBadLength()
104+
{
105+
$result = $this->assertCloseEnoughString('apples & oranges', 'apples');
106+
$this->assertFalse($result, 'Different string lengths should have returned false');
92107
}
93108

94109
}

0 commit comments

Comments
 (0)