TYPO3 CMS  TYPO3_6-2
ModuleDataStorageServiceTest.php
Go to the documentation of this file.
1 <?php
3 
21 
25  public function loadModuleDataReturnsModuleDataObjectForEmptyModuleData() {
26  // The test calls several static dependencies that can not be mocked and
27  // call database in the end, so we need to mock the database here.
28  $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
29 
30  // Simulate empty module data
31  $GLOBALS['BE_USER'] = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication', array(), array(), '', FALSE);
32  $GLOBALS['BE_USER']->uc = array();
33  $GLOBALS['BE_USER']->uc['moduleData'] = array();
34 
36  $subject = $this->getAccessibleMock('TYPO3\\CMS\\Beuser\\Service\\ModuleDataStorageService', array('dummy'), array(), '', FALSE);
37  $objectManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', array(), array(), '', FALSE);
38  $moduleDataMock = $this->getMock('TYPO3\\CMS\\Beuser\\Domain\\Model\\ModuleData', array(), array(), '', FALSE);
39  $objectManagerMock
40  ->expects($this->once())
41  ->method('get')
42  ->with('TYPO3\\CMS\\Beuser\\Domain\\Model\\ModuleData')
43  ->will($this->returnValue($moduleDataMock));
44  $subject->_set('objectManager', $objectManagerMock);
45 
46  $this->assertSame($moduleDataMock, $subject->loadModuleData());
47  }
48 }
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]