‪TYPO3CMS  ‪main
FileLockStrategyTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 final class ‪FileLockStrategyTest extends UnitTestCase
29 {
34  {
36  new ‪FileLockStrategy('999999999');
37  self::assertDirectoryExists(‪Environment::getVarPath() . '/' . ‪FileLockStrategy::FILE_LOCK_FOLDER);
38  }
39 
44  {
45  $lock = $this->getAccessibleMock(FileLockStrategy::class, null, ['999999999']);
46  self::assertSame(‪Environment::getVarPath() . '/' . ‪FileLockStrategy::FILE_LOCK_FOLDER . 'flock_' . md5('999999999'), $lock->_get('filePath'));
47  }
48 
52  public function ‪getPriorityReturnsDefaultPriority(): void
53  {
55  }
56 
60  public function ‪setPriority(): void
61  {
62  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['strategies'][FileLockStrategy::class]['priority'] = 10;
63 
64  self::assertEquals(10, ‪FileLockStrategy::getPriority());
65  unset(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['strategies'][FileLockStrategy::class]['priority']);
66  }
67 }
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\getPriorityReturnsDefaultPriority
‪getPriorityReturnsDefaultPriority()
Definition: FileLockStrategyTest.php:52
‪TYPO3\CMS\Core\Locking\FileLockStrategy\DEFAULT_PRIORITY
‪const DEFAULT_PRIORITY
Definition: FileLockStrategy.php:33
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\setPriority
‪setPriority()
Definition: FileLockStrategyTest.php:60
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static getVarPath()
Definition: Environment.php:197
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting
‪constructorCreatesLockDirectoryIfNotExisting()
Definition: FileLockStrategyTest.php:33
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest
Definition: FileLockStrategyTest.php:29
‪TYPO3\CMS\Core\Tests\Unit\Locking
Definition: FileLockStrategyTest.php:18
‪TYPO3\CMS\Core\Locking\FileLockStrategy\getPriority
‪static int getPriority()
Definition: FileLockStrategy.php:162
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Utility\GeneralUtility\rmdir
‪static bool rmdir($path, $removeNonEmpty=false)
Definition: GeneralUtility.php:1691
‪TYPO3\CMS\Core\Locking\FileLockStrategy\FILE_LOCK_FOLDER
‪const FILE_LOCK_FOLDER
Definition: FileLockStrategy.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51
‪TYPO3\CMS\Core\Locking\FileLockStrategy
Definition: FileLockStrategy.php:29
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\constructorSetsFilePathToExpectedValue
‪constructorSetsFilePathToExpectedValue()
Definition: FileLockStrategyTest.php:43