PEAR2_Cache_SHMPEAR2_Cache_SHM-0.1.3/tests/PHPT/Common/testSingleFileLockAndUnlock.phpt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--TEST--
Tests locking and unlocking within a single file
--FILE--
<?php
require_once '../includes/runner.php';

$adapterName = 'PEAR2\Cache\SHM\Adapter\\' . $adapter;
$object = new $adapterName('TEST');

assertSame(true, $object->lock('key'), __FILE__);
assertSame(false, $object->lock('key'), __FILE__);
assertSame(true, $object->unlock('key'), __FILE__);
assertSame(false, $object->unlock('key'), __FILE__);

assertSame(true, $object->lock('key'), __FILE__);
assertSame(false, $object->lock('key'), __FILE__);
assertSame(true, $object->unlock('key'), __FILE__);
assertSame(false, $object->unlock('key'), __FILE__);
?>
--EXPECT--
EOF