00001 <?php 00008 class UTFileLock extends foUnitTestBase 00009 { 00010 public function doTest() 00011 { 00012 $this->_test(); 00013 } 00014 00015 private function _test() 00016 { 00017 $this->setSectionLabel('deleteAllLocks'); 00018 $lockRoot = new FileLock('/'); 00019 eval($this->needFalse('$lockRoot->deleteAllLocks()')); 00020 00021 $lockEmpty = new FileLock(''); 00022 eval($this->needFalse('$lockEmpty->deleteAllLocks()')); 00023 00024 $this->setSectionLabel('isLockExpired'); 00025 $lock = new FileLock('/tmp/locks/'); 00026 eval($this->needTrue('$lock->deleteAllLocks()')); 00027 00028 eval($this->needTrue('$lock->isLockExpired("SMS", 60, false)')); 00029 eval($this->needFalse('$lock->isLockExpired("SMS", 60, false)')); 00030 eval($this->needFalse('$lock->isLockExpired("SMS", 60, false)')); 00031 00032 eval($this->needTrue('$lock->isLockExpired("SMS", 60, true)')); 00033 eval($this->needFalse('$lock->isLockExpired("SMS", 60, true)')); 00034 eval($this->needFalse('$lock->isLockExpired("SMS", 60, true)')); 00035 00036 eval($this->needTrue('$lock->isLockExpired("EMAIL")')); 00037 eval($this->needFalse('$lock->isLockExpired("EMAIL")')); 00038 00039 eval($this->needTrue('$lock->isLockExpired("PHONE", 0)')); 00040 sleep(1); 00041 eval($this->needTrue('$lock->isLockExpired("PHONE", 0)')); 00042 } 00043 } 00044 ?>