TYPO3 CMS  TYPO3_6-2
AdminPanelViewTest.php
Go to the documentation of this file.
1 <?php
3 
21 
25  public function setUp() {
26  $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
27  }
28 
33  $strTime = '2013-01-01 01:00:00';
34  $timestamp = strtotime($strTime);
35 
36  $backendUser = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
37  $backendUser->uc['TSFE_adminConfig']['preview_simulateDate'] = $timestamp;
38  unset($backendUser->extAdminConfig['override.']['preview.']);
39  unset($backendUser->extAdminConfig['override.']['preview']);
40  $GLOBALS['BE_USER'] = $backendUser;
41 
42  $adminPanelMock = $this->getMock('TYPO3\\CMS\\Frontend\\View\\AdminPanelView', array('isAdminModuleEnabled','isAdminModuleOpen'), array(), '', FALSE);
43  $adminPanelMock->expects($this->any())->method('isAdminModuleEnabled')->will($this->returnValue(TRUE));
44  $adminPanelMock->expects($this->any())->method('isAdminModuleOpen')->will($this->returnValue(TRUE));
45 
46  $timestampReturned = $adminPanelMock->extGetFeAdminValue('preview', 'simulateDate');
47  $this->assertEquals($timestamp, $timestampReturned);
48  }
49 
51  // Test concerning extendAdminPanel hook
53 
58  public function extendAdminPanelHookThrowsExceptionIfHookClassDoesNotImplementInterface() {
59  $hookClass = $this->getUniqueId('tx_coretest');
60  eval('class ' . $hookClass . ' {}');
61  $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'][] = $hookClass;
63  $adminPanelMock = $this->getMock('TYPO3\\CMS\\Frontend\\View\\AdminPanelView', array('dummy'), array(), '', FALSE);
64  $adminPanelMock->display();
65  }
66 
70  public function extendAdminPanelHookCallsExtendAdminPanelMethodOfHook() {
71  $hookClass = $this->getUniqueId('tx_coretest');
72  $hookMock = $this->getMock('TYPO3\\CMS\\Frontend\\View\\AdminPanelViewHookInterface', array(), array(), $hookClass);
73  $GLOBALS['T3_VAR']['getUserObj'][$hookClass] = $hookMock;
74  $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'][] = $hookClass;
76  $adminPanelMock = $this->getMock('TYPO3\\CMS\\Frontend\\View\\AdminPanelView', array('extGetLL'), array(), '', FALSE);
77  $hookMock->expects($this->once())->method('extendAdminPanel')->with($this->isType('string'), $this->isInstanceOf('TYPO3\\CMS\\Frontend\\View\\AdminPanelView'));
78  $adminPanelMock->display();
79  }
80 
81 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]