[BUGFIX] Multiple fixes for Locking API and TSFE locking
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / Locking / Fixtures / DummyLock.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Unit\Locking\Fixtures;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Locking\LockingStrategyInterface;
18
19 /**
20 * Dummy locking
21 *
22 * @author Markus Klein <klein.t3@reelworx.at>
23 */
24 class DummyLock implements LockingStrategyInterface {
25
26 /**
27 * @return int LOCK_CAPABILITY_* elements combined with bit-wise OR
28 */
29 static public function getCapabilities() {
30 return self::LOCK_CAPABILITY_EXCLUSIVE;
31 }
32
33 /**
34 * @return int Returns a priority for the method. 0 to 100, 100 is highest
35 */
36 static public function getPriority() {
37 return 100;
38 }
39
40 /**
41 * @param string $subject ID to identify this lock in the system
42 */
43 public function __construct($subject) {
44 }
45
46 /**
47 * Try to acquire a lock
48 *
49 * @param int $mode LOCK_CAPABILITY_EXCLUSIVE or LOCK_CAPABILITY_SHARED
50 * @return bool Returns TRUE if the lock was acquired successfully
51 */
52 public function acquire($mode = self::LOCK_CAPABILITY_EXCLUSIVE) {
53 return FALSE;
54 }
55
56 /**
57 * Release the lock
58 *
59 * @return bool Returns TRUE on success or FALSE on failure
60 */
61 public function release() {
62 return FALSE;
63 }
64
65 /**
66 * Get status of this lock
67 *
68 * @return bool Returns TRUE if lock is acquired by this locker, FALSE otherwise
69 */
70 public function isAcquired() {
71 return FALSE;
72 }
73
74 /**
75 * Destroys the resource associated with the lock
76 *
77 * @return void
78 */
79 public function destroy() {
80 }
81 }