2 namespace TYPO3\CMS\Frontend\Tests\Unit\View;
27 $GLOBALS[
'LANG'] = $this->getMock(\TYPO3\CMS\Lang\LanguageService::class, array(), array(),
'',
false);
35 $strTime =
'2013-01-01 01:00:00';
36 $timestamp = strtotime($strTime);
38 $backendUser = $this->getMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
39 $backendUser->uc[
'TSFE_adminConfig'][
'preview_simulateDate'] = $timestamp;
40 unset($backendUser->extAdminConfig[
'override.'][
'preview.']);
41 unset($backendUser->extAdminConfig[
'override.'][
'preview']);
44 $adminPanelMock = $this->getMock(\TYPO3\CMS\Frontend\View\AdminPanelView::class, array(
'isAdminModuleEnabled',
'isAdminModuleOpen'), array(),
'',
false);
45 $adminPanelMock->expects($this->any())->method(
'isAdminModuleEnabled')->will($this->returnValue(
true));
46 $adminPanelMock->expects($this->any())->method(
'isAdminModuleOpen')->will($this->returnValue(
true));
48 $timestampReturned = $adminPanelMock->extGetFeAdminValue(
'preview',
'simulateDate');
49 $this->assertEquals($timestamp, $timestampReturned);
60 public function extendAdminPanelHookThrowsExceptionIfHookClassDoesNotImplementInterface()
62 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_adminpanel.php'][
'extendAdminPanel'][] = \TYPO3\CMS\Frontend\Tests\Unit\Fixtures\AdminPanelHookWithoutInterfaceFixture::class;
64 $adminPanelMock = $this->getMock(\TYPO3\CMS\Frontend\View\AdminPanelView::class, array(
'dummy'), array(),
'',
false);
65 $adminPanelMock->display();
71 public function extendAdminPanelHookCallsExtendAdminPanelMethodOfHook()
73 $hookClass = $this->getUniqueId(
'tx_coretest');
74 $hookMock = $this->getMock(\TYPO3\CMS\Frontend\View\AdminPanelViewHookInterface::class, array(), array(), $hookClass);
75 $GLOBALS[
'T3_VAR'][
'getUserObj'][$hookClass] = $hookMock;
76 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_adminpanel.php'][
'extendAdminPanel'][] = $hookClass;
78 $adminPanelMock = $this->getMock(\TYPO3\CMS\Frontend\View\AdminPanelView::class, array(
'extGetLL'), array(),
'',
false);
79 $hookMock->expects($this->once())->method(
'extendAdminPanel')->with($this->isType(
'string'), $this->isInstanceOf(\TYPO3\CMS\Frontend\View\AdminPanelView::class));
80 $adminPanelMock->display();