30 public function getTableReturnsPreviouslySetTable() {
33 $subject = $this->getMock(
'TYPO3\\CMS\Core\Log\\Writer\\DatabaseWriter', array(
'dummy'), array(),
'', FALSE);
34 $subject->setLogTable($logTable);
35 $this->assertSame($logTable, $subject->getLogTable());
42 public function writeLogThrowsExceptionIfDatabaseInsertFailed() {
43 $GLOBALS[
'TYPO3_DB'] = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(),
'', FALSE);
44 $GLOBALS[
'TYPO3_DB']->expects($this->once())->method(
'exec_INSERTquery')->will($this->returnValue(FALSE));
46 $logRecordMock = $this->getMock(
'TYPO3\\CMS\\Core\\Log\\LogRecord', array(), array(),
'', FALSE);
48 $subject = $this->getMock(
'TYPO3\\CMS\Core\Log\\Writer\\DatabaseWriter', array(
'dummy'), array(),
'', FALSE);
49 $subject->writeLog($logRecordMock);
55 public function writeLogInsertsToSpecifiedTable() {
57 $GLOBALS[
'TYPO3_DB'] = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(),
'', FALSE);
58 $GLOBALS[
'TYPO3_DB']->expects($this->once())->method(
'exec_INSERTquery')->with($logTable, $this->anything());
60 $logRecordMock = $this->getMock(
'TYPO3\\CMS\\Core\\Log\\LogRecord', array(), array(),
'', FALSE);
62 $subject = $this->getMock(
'TYPO3\\CMS\Core\Log\\Writer\\DatabaseWriter', array(
'dummy'), array(),
'', FALSE);
63 $subject->setLogTable($logTable);
64 $subject->writeLog($logRecordMock);
70 public function writeLogInsertsLogRecordWithGivenProperties() {
71 $logRecordData = array(
80 $logRecordFixture = $this->getMock(
'TYPO3\\CMS\\Core\\Log\\LogRecord', array(), array(),
'', FALSE);
81 $logRecordFixture->expects($this->any())->method(
'getRequestId')->will($this->returnValue($logRecordData[
'request_id']));
82 $logRecordFixture->expects($this->any())->method(
'getCreated')->will($this->returnValue($logRecordData[
'time_micro']));
83 $logRecordFixture->expects($this->any())->method(
'getComponent')->will($this->returnValue($logRecordData[
'component']));
84 $logRecordFixture->expects($this->any())->method(
'getLevel')->will($this->returnValue($logRecordData[
'level']));
85 $logRecordFixture->expects($this->any())->method(
'getMessage')->will($this->returnValue($logRecordData[
'message']));
86 $logRecordFixture->expects($this->any())->method(
'getData')->will($this->returnValue(array()));
91 $GLOBALS[
'TYPO3_DB'] = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(),
'', FALSE);
92 $GLOBALS[
'TYPO3_DB']->expects($this->once())->method(
'exec_INSERTquery')->with($this->anything(), $logRecordData);
94 $subject->writeLog($logRecordFixture);
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]