From 14d631d29fafdda4100c54906725f4dce1889061 Mon Sep 17 00:00:00 2001 From: nbm Date: Mon, 15 May 2006 13:34:47 +0000 Subject: [PATCH] Convert existing test to SimpleTest unit test, and add more tests. --- tests/cache/testCache.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+), 0 deletions(-) create mode 100644 tests/cache/testCache.php diff --git a/tests/cache/testCache.php b/tests/cache/testCache.php new file mode 100644 index 0000000..b73c084 --- /dev/null +++ b/tests/cache/testCache.php @@ -0,0 +1,40 @@ + 'foo', + )); + if (!$this->assertGroup($g)) { + return; + } + $f = Group::getList(); + $iNowNumGroups = count($f); + $this->assertEqual($iNumGroups + 1, $iNowNumGroups, 'New group not in list'); + DBUtil::rollback(); + } + + function testRollback() { + $f = Group::getList(); + $iNumGroups = count($f); + DBUtil::startTransaction(); + $g = Group::createFromArray(array( + 'name' => 'rollback', + )); + if (!$this->assertGroup($g)) { + return; + } + $f = Group::getList(); + $iNowNumGroups = count($f); + $this->assertEqual($iNumGroups + 1, $iNowNumGroups, 'New group not in list'); + DBUtil::rollback(); + $f = Group::getList(); + $iRollbackNumGroups = count($f); + $this->assertEqual($iNumGroups, $iRollbackNumGroups, 'New group still in list (should be rolled back)'); + } +} -- libgit2 0.21.4