[TASK] Update caching framework to latest FLOW3 version
[Packages/TYPO3.CMS.git] / tests / t3lib / class.t3lib_lockTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Testcase for t3lib_lock
27 *
28 * @author Christian Kuhn <lolli@schwarzbu.ch>
29 *
30 * @package TYPO3
31 * @subpackage t3lib
32 */
33
34 class t3lib_lockTest extends tx_phpunit_testcase {
35
36 /**
37 * Enable backup of global and system variables
38 *
39 * @var boolean
40 */
41 protected $backupGlobals = TRUE;
42
43 /**
44 * Exclude TYPO3_DB from backup/ restore of $GLOBALS
45 * because resource types cannot be handled during serializing
46 *
47 * @var array
48 */
49 protected $backupGlobalsBlacklist = array('TYPO3_DB');
50
51 ///////////////////////////////
52 // tests concerning acquire
53 ///////////////////////////////a
54
55 /**
56 * @test
57 */
58 public function acquireFixesPermissionsOnLockFileIfUsingSimpleLogging() {
59 if (TYPO3_OS == 'WIN') {
60 $this->markTestSkipped('acquireFixesPermissionsOnLockFileIfUsingSimpleLogging() test not available on Windows.');
61 }
62
63 // Use a very high id to be unique
64 $instance = new t3lib_lock(999999999, 'simple');
65 $pathOfLockFile = $instance->getResource();
66 $GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'] = '0777';
67
68 // Acquire lock, get actual file permissions and clean up
69 $instance->acquire();
70 clearstatcache();
71 $resultFilePermissions = substr(decoct(fileperms($pathOfLockFile)), 2);
72 $instance->__destruct();
73
74 $this->assertEquals($resultFilePermissions, '0777');
75 }
76 }
77 ?>