2 /***************************************************************
5 * (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
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.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
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.
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
26 * Testcase for t3lib_lock
28 * @author Christian Kuhn <lolli@schwarzbu.ch>
34 class t3lib_lockTest
extends tx_phpunit_testcase
{
37 * Enable backup of global and system variables
41 protected $backupGlobals = TRUE;
44 * Exclude TYPO3_DB from backup/ restore of $GLOBALS
45 * because resource types cannot be handled during serializing
49 protected $backupGlobalsBlacklist = array('TYPO3_DB');
51 ///////////////////////////////
52 // tests concerning acquire
53 ///////////////////////////////a
58 public function acquireFixesPermissionsOnLockFileIfUsingSimpleLogging() {
59 if (TYPO3_OS
== 'WIN') {
60 $this->markTestSkipped('acquireFixesPermissionsOnLockFileIfUsingSimpleLogging() test not available on Windows.');
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';
68 // Acquire lock, get actual file permissions and clean up
71 $resultFilePermissions = substr(decoct(fileperms($pathOfLockFile)), 2);
72 $instance->__destruct();
74 $this->assertEquals($resultFilePermissions, '0777');