[BUGFIX] Some unit tests fail with "Cannot modify header information"
[Packages/TYPO3.CMS.git] / tests / t3lib / class.t3lib_beuserauthTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Oliver Klee (typo3-coding@oliverklee.de)
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 the t3lib_beUserAuth class in the TYPO3 Core extension.
27 *
28 * @package TYPO3
29 * @subpackage t3lib
30 *
31 * @author Oliver Klee <typo3-coding@oliverklee.de>
32 */
33 class t3lib_beUserAuthTest extends tx_phpunit_testcase {
34 /**
35 * @var t3lib_beUserAuth
36 */
37 private $fixture = NULL;
38
39 /**
40 * Enable backup of global and system variables
41 *
42 * @var boolean
43 */
44 protected $backupGlobals = TRUE;
45
46 /**
47 * Exclude TYPO3_DB from backup/ restore of $GLOBALS
48 * because resource types cannot be handled during serializing
49 *
50 * @var array
51 */
52 protected $backupGlobalsBlacklist = array('TYPO3_DB');
53
54 public function setUp() {
55 // reset hooks
56 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'] = array();
57 $this->fixture = new t3lib_beUserAuth();
58 }
59
60 public function tearDown() {
61 unset($this->fixture);
62
63 t3lib_formProtection_Factory::purgeInstances();
64 }
65
66
67 /////////////////////////////////////////
68 // Tests concerning the form protection
69 /////////////////////////////////////////
70
71 /**
72 * @test
73 */
74 public function logoffCleansFormProtection() {
75 $formProtection = $this->getMock(
76 't3lib_formprotection_BackendFormProtection', array('clean')
77 );
78 $formProtection->expects($this->atLeastOnce())->method('clean');
79 t3lib_formProtection_Factory::set(
80 't3lib_formprotection_BackendFormProtection', $formProtection
81 );
82
83 $this->fixture->logoff();
84 }
85 }
86 ?>