‪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 
20 use PHPUnit\Framework\Attributes\Test;
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
25 
29 final class ‪FileLockStrategyTest extends UnitTestCase
30 {
31  #[Test]
33  {
35  new ‪FileLockStrategy('999999999');
36  self::assertDirectoryExists(‪Environment::getVarPath() . '/' . ‪FileLockStrategy::FILE_LOCK_FOLDER);
37  }
38 
39  #[Test]
41  {
42  $lock = $this->getAccessibleMock(FileLockStrategy::class, null, ['999999999']);
43  self::assertSame(‪Environment::getVarPath() . '/' . ‪FileLockStrategy::FILE_LOCK_FOLDER . 'flock_' . md5('999999999'), $lock->_get('filePath'));
44  }
45 
46  #[Test]
47  public function ‪getPriorityReturnsDefaultPriority(): void
48  {
50  }
51 
52  #[Test]
53  public function ‪setPriority(): void
54  {
55  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['strategies'][FileLockStrategy::class]['priority'] = 10;
56 
57  self::assertEquals(10, ‪FileLockStrategy::getPriority());
58  unset(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['strategies'][FileLockStrategy::class]['priority']);
59  }
60 }
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\getPriorityReturnsDefaultPriority
‪getPriorityReturnsDefaultPriority()
Definition: FileLockStrategyTest.php:47
‪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:53
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static getVarPath()
Definition: Environment.php:197
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\constructorCreatesLockDirectoryIfNotExisting
‪constructorCreatesLockDirectoryIfNotExisting()
Definition: FileLockStrategyTest.php:32
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest
Definition: FileLockStrategyTest.php:30
‪TYPO3\CMS\Core\Utility\GeneralUtility\rmdir
‪static bool rmdir(string $path, bool $removeNonEmpty=false)
Definition: GeneralUtility.php:1702
‪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\Locking\FileLockStrategy\FILE_LOCK_FOLDER
‪const FILE_LOCK_FOLDER
Definition: FileLockStrategy.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Core\Locking\FileLockStrategy
Definition: FileLockStrategy.php:29
‪TYPO3\CMS\Core\Tests\Unit\Locking\FileLockStrategyTest\constructorSetsFilePathToExpectedValue
‪constructorSetsFilePathToExpectedValue()
Definition: FileLockStrategyTest.php:40