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)'); + } +}