[TASK] Namespace and move t3lib unit tests - 4
authorWouter Wolters <typo3@wouterwolters.nl>
Wed, 29 Aug 2012 19:04:52 +0000 (21:04 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 2 Sep 2012 08:31:22 +0000 (10:31 +0200)
This patch moves most unit tests of the tests/Unit/t3lib/*
directory to the core extension, following the new name scheme.

Change-Id: Ia3e45b7557b0d28edd3dbf16631f537bd8e255c3
Resolves: #40392
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/14205
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
52 files changed:
tests/Unit/t3lib/l10n/parser/class.t3lib_l10n_parser_llxmlTest.php [deleted file]
tests/Unit/t3lib/l10n/parser/class.t3lib_l10n_parser_xliffTest.php [deleted file]
tests/Unit/t3lib/l10n/parser/fixtures/fr.locallang.xlf [deleted file]
tests/Unit/t3lib/l10n/parser/fixtures/fr.locallang_override.xlf [deleted file]
tests/Unit/t3lib/l10n/parser/fixtures/locallang.xlf [deleted file]
tests/Unit/t3lib/l10n/parser/fixtures/locallang.xml [deleted file]
tests/Unit/t3lib/l10n/parser/fixtures/locallangOnlyDefaultLanguage.xml [deleted file]
tests/Unit/t3lib/l10n/parser/fixtures/locallang_override.xlf [deleted file]
tests/Unit/t3lib/l10n/parser/fixtures/locallang_override.xml [deleted file]
tests/Unit/t3lib/log/class.t3lib_log_levelTest.php [deleted file]
tests/Unit/t3lib/log/class.t3lib_log_loggerTest.php [deleted file]
tests/Unit/t3lib/log/class.t3lib_log_logmanagerTest.php [deleted file]
tests/Unit/t3lib/log/class.t3lib_log_recordTest.php [deleted file]
tests/Unit/t3lib/log/fixtures/class.t3lib_log_processor_fixture.php [deleted file]
tests/Unit/t3lib/log/fixtures/class.t3lib_log_writer_failing.php [deleted file]
tests/Unit/t3lib/log/fixtures/class.t3lib_log_writer_fixture.php [deleted file]
tests/Unit/t3lib/log/processor/class.t3lib_log_processor_abstractTest.php [deleted file]
tests/Unit/t3lib/log/processor/class.t3lib_log_processor_abstractmemoryTest.php [deleted file]
tests/Unit/t3lib/log/processor/class.t3lib_log_processor_introspectionTest.php [deleted file]
tests/Unit/t3lib/log/processor/class.t3lib_log_processor_memoryPeakUsageTest.php [deleted file]
tests/Unit/t3lib/log/processor/class.t3lib_log_processor_memoryUsageTest.php [deleted file]
tests/Unit/t3lib/log/processor/class.t3lib_log_processor_processorTest.php [deleted file]
tests/Unit/t3lib/log/processor/class.t3lib_log_processor_webTest.php [deleted file]
tests/Unit/t3lib/log/writer/class.t3lib_log_writer_abstractTest.php [deleted file]
tests/Unit/t3lib/log/writer/class.t3lib_log_writer_databaseTest.php [deleted file]
tests/Unit/t3lib/log/writer/class.t3lib_log_writer_fileTest.php [deleted file]
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/fr.locallang.xlf [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/fr.locallang_override.xlf [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang.xlf [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang.xml [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallangOnlyDefaultLanguage.xml [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang_override.xlf [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang_override.xml [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Fixtures/ProcessorFixture.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFailing.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFixture.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/LogLevelTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/LogManagerTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/LogRecordTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/LoggerTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Processor/AbstractMemoryTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Processor/AbstractTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Processor/MemoryPeakUsageTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Processor/MemoryUsageTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Processor/ProcessorTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Processor/WebTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Writer/AbstractTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Log/Writer/FileTest.php [new file with mode: 0644]

diff --git a/tests/Unit/t3lib/l10n/parser/class.t3lib_l10n_parser_llxmlTest.php b/tests/Unit/t3lib/l10n/parser/class.t3lib_l10n_parser_llxmlTest.php
deleted file mode 100644 (file)
index 6ba5e3d..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for class t3lib_l10n_parser_llxml.
- *
- * @author Xavier Perseguers <xavier@typo3.org>
- * @package TYPO3
- */
-class t3lib_l10n_parser_llxmlTest extends tx_phpunit_testcase {
-
-       /**
-        * @var t3lib_l10n_parser_llxml
-        */
-       protected $parser;
-
-       /**
-        * @var array
-        */
-       protected $locallangXMLOverride;
-
-       /**
-        * @var string
-        */
-       protected $l10nPriority;
-
-       /**
-        * @var array
-        */
-       protected $llxmlFileNames;
-
-       /**
-        * Prepares the environment before running a test.
-        */
-       public function setUp() {
-               // Backup locallangXMLOverride and localization format priority
-               $this->locallangXMLOverride = $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
-               $this->l10nPriority = $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'];
-               $this->parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
-               $testFinder = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Phpunit_Service_TestFinder');
-               $fixturePath = $testFinder->getAbsoluteCoreTestsPath() . 'Unit/t3lib/l10n/parser/fixtures/';
-               $this->llxmlFileNames = array(
-                       'locallang' => $fixturePath . 'locallang.xml',
-                       'locallang_override' => $fixturePath . 'locallang_override.xml',
-                       'locallangOnlyDefaultLanguage' => $fixturePath . 'locallangOnlyDefaultLanguage.xml'
-               );
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = 'xml';
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
-               // Clear localization cache
-               $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush();
-       }
-
-       /**
-        * Cleans up the environment after running a test.
-        */
-       public function tearDown() {
-               unset($this->parser);
-               // Restore locallangXMLOverride and localization format priority
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = $this->locallangXMLOverride;
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = $this->l10nPriority;
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
-       }
-
-       /**
-        * @test
-        */
-       public function canParseLlxmlInEnglish() {
-               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallang'], 'default');
-               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
-               $expectedLabels = array(
-                       'label1' => 'This is label #1',
-                       'label2' => 'This is label #2',
-                       'label3' => 'This is label #3'
-               );
-               foreach ($expectedLabels as $key => $expectedLabel) {
-                       $this->assertEquals($expectedLabel, $LOCAL_LANG['default'][$key][0]['target']);
-               }
-       }
-
-       /**
-        * @test
-        */
-       public function canParseLlxmlInFrench() {
-               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallang'], 'fr');
-               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
-               $expectedLabels = array(
-                       'label1' => 'Ceci est le libellé no. 1',
-                       'label2' => 'Ceci est le libellé no. 2',
-                       'label3' => 'Ceci est le libellé no. 3'
-               );
-               foreach ($expectedLabels as $key => $expectedLabel) {
-                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
-               }
-       }
-
-       /**
-        * @test
-        */
-       public function canParseLlxmlInFrenchAndReturnsDefaultLabelsIfNoTranslationIsFound() {
-               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallangOnlyDefaultLanguage'], 'fr');
-               $expectedLabels = array(
-                       'label1' => 'This is label #1',
-                       'label2' => 'This is label #2',
-                       'label3' => 'This is label #3'
-               );
-               foreach ($expectedLabels as $key => $expectedLabel) {
-                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
-               }
-       }
-
-       /**
-        * @test
-        */
-       public function canOverrideLlxml() {
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->llxmlFileNames['locallang']][] = $this->llxmlFileNames['locallang_override'];
-               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->llxmlFileNames['locallang'], 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->llxmlFileNames['locallang'], 'fr'));
-               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
-               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
-               $expectedLabels = array(
-                       'default' => array(
-                               'label1' => 'This is my 1st label',
-                               'label2' => 'This is my 2nd label',
-                               'label3' => 'This is label #3'
-                       ),
-                       'fr' => array(
-                               'label1' => 'Ceci est mon 1er libellé',
-                               'label2' => 'Ceci est le libellé no. 2',
-                               'label3' => 'Ceci est mon 3e libellé'
-                       )
-               );
-               foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) {
-                       foreach ($expectedLanguageLabels as $key => $expectedLabel) {
-                               $this->assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']);
-                       }
-               }
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/class.t3lib_l10n_parser_xliffTest.php b/tests/Unit/t3lib/l10n/parser/class.t3lib_l10n_parser_xliffTest.php
deleted file mode 100644 (file)
index 936ba4e..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for class t3lib_l10n_parser_xliff.
- *
- * @author Xavier Perseguers <xavier@typo3.org>
- * @package TYPO3
- */
-class t3lib_l10n_parser_xliffTest extends tx_phpunit_testcase {
-
-       /**
-        * @var t3lib_l10n_parser_xliff
-        */
-       protected $parser;
-
-       /**
-        * @var array
-        */
-       protected $locallangXMLOverride;
-
-       /**
-        * @var string
-        */
-       protected $l10nPriority;
-
-       /**
-        * @var array
-        */
-       protected $xliffFileNames;
-
-       /**
-        * Prepares the environment before running a test.
-        */
-       public function setUp() {
-               // Backup locallangXMLOverride and localization format priority
-               $this->locallangXMLOverride = $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
-               $this->l10nPriority = $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'];
-               $this->parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\XliffParser');
-               $testFinder = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Phpunit_Service_TestFinder');
-               $fixturePath = $testFinder->getAbsoluteCoreTestsPath() . 'Unit/t3lib/l10n/parser/fixtures/';
-               $this->xliffFileNames = array(
-                       'locallang' => $fixturePath . 'locallang.xlf',
-                       'locallang_override' => $fixturePath . 'locallang_override.xlf',
-                       'locallang_override_fr' => $fixturePath . 'fr.locallang_override.xlf'
-               );
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = 'xlf';
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
-               // Clear localization cache
-               $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush();
-       }
-
-       /**
-        * Cleans up the environment after running a test.
-        */
-       public function tearDown() {
-               unset($this->parser);
-               // Restore locallangXMLOverride and localization format priority
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = $this->locallangXMLOverride;
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = $this->l10nPriority;
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
-       }
-
-       /**
-        * @test
-        */
-       public function canParseXliffInEnglish() {
-               $LOCAL_LANG = $this->parser->getParsedData($this->xliffFileNames['locallang'], 'default');
-               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
-               $expectedLabels = array(
-                       'label1' => 'This is label #1',
-                       'label2' => 'This is label #2',
-                       'label3' => 'This is label #3'
-               );
-               foreach ($expectedLabels as $key => $expectedLabel) {
-                       $this->assertEquals($expectedLabel, $LOCAL_LANG['default'][$key][0]['target']);
-               }
-       }
-
-       /**
-        * @test
-        */
-       public function canParseXliffInFrench() {
-               $LOCAL_LANG = $this->parser->getParsedData($this->xliffFileNames['locallang'], 'fr');
-               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
-               $expectedLabels = array(
-                       'label1' => 'Ceci est le libellé no. 1',
-                       'label2' => 'Ceci est le libellé no. 2',
-                       'label3' => 'Ceci est le libellé no. 3'
-               );
-               foreach ($expectedLabels as $key => $expectedLabel) {
-                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
-               }
-       }
-
-       /**
-        * @test
-        */
-       public function canOverrideXliff() {
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override'];
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
-               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'fr'));
-               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
-               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
-               $expectedLabels = array(
-                       'default' => array(
-                               'label1' => 'This is my 1st label',
-                               'label2' => 'This is my 2nd label',
-                               'label3' => 'This is label #3'
-                       ),
-                       'fr' => array(
-                               'label1' => 'Ceci est mon 1er libellé',
-                               'label2' => 'Ceci est le libellé no. 2',
-                               'label3' => 'Ceci est mon 3e libellé'
-                       )
-               );
-               foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) {
-                       foreach ($expectedLanguageLabels as $key => $expectedLabel) {
-                               $this->assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']);
-                       }
-               }
-       }
-
-       /**
-        * This test will make sure method t3lib_div::llXmlAutoFileName() will not prefix twice the
-        * language key to the localization file.
-        *
-        * @test
-        */
-       public function canOverrideXliffWithFrenchOnly() {
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
-               $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'fr');
-               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
-               $expectedLabels = array(
-                       'label1' => 'Ceci est mon 1er libellé',
-                       'label2' => 'Ceci est le libellé no. 2',
-                       'label3' => 'Ceci est mon 3e libellé'
-               );
-               foreach ($expectedLabels as $key => $expectedLabel) {
-                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
-               }
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/fixtures/fr.locallang.xlf b/tests/Unit/t3lib/l10n/parser/fixtures/fr.locallang.xlf
deleted file mode 100644 (file)
index 0401714..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
-       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests" target-language="fr">
-               <header/>
-               <body>
-                       <trans-unit id="label1" xml:space="preserve">
-                               <source>This is label #1</source>
-                               <target>Ceci est le libellé no. 1</target>
-                       </trans-unit>
-                       <trans-unit id="label2" xml:space="preserve">
-                               <source>This is label #2</source>
-                               <target>Ceci est le libellé no. 2</target>
-                       </trans-unit>
-                       <trans-unit id="label3" xml:space="preserve">
-                               <source>This is label #3</source>
-                               <target>Ceci est le libellé no. 3</target>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/fixtures/fr.locallang_override.xlf b/tests/Unit/t3lib/l10n/parser/fixtures/fr.locallang_override.xlf
deleted file mode 100644 (file)
index ccf1920..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
-       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests" target-language="fr">
-               <header/>
-               <body>
-                       <trans-unit id="label1" xml:space="preserve">
-                               <source>This is label #1</source>
-                               <target>Ceci est mon 1er libellé</target>
-                       </trans-unit>
-                       <trans-unit id="label3" xml:space="preserve">
-                               <source>This is label #3</source>
-                               <target>Ceci est mon 3e libellé</target>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/fixtures/locallang.xlf b/tests/Unit/t3lib/l10n/parser/fixtures/locallang.xlf
deleted file mode 100644 (file)
index 06c5639..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
-       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests">
-               <header/>
-               <body>
-                       <trans-unit id="label1" xml:space="preserve">
-                               <source>This is label #1</source>
-                       </trans-unit>
-                       <trans-unit id="label2" xml:space="preserve">
-                               <source>This is label #2</source>
-                       </trans-unit>
-                       <trans-unit id="label3" xml:space="preserve">
-                               <source>This is label #3</source>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/fixtures/locallang.xml b/tests/Unit/t3lib/l10n/parser/fixtures/locallang.xml
deleted file mode 100644 (file)
index a5d7543..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3locallang>
-       <meta type="array">
-               <description>Fixture labels for unit tests.</description>
-               <type>module</type>
-       </meta>
-       <data type="array">
-               <languageKey index="default" type="array">
-                       <label index="label1">This is label #1</label>
-                       <label index="label2">This is label #2</label>
-                       <label index="label3">This is label #3</label>
-               </languageKey>
-
-               <languageKey index="fr" type="array">
-                       <label index="label1">Ceci est le libellé no. 1</label>
-                       <label index="label2">Ceci est le libellé no. 2</label>
-                       <label index="label3">Ceci est le libellé no. 3</label>
-               </languageKey>
-       </data>
-</T3locallang>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/fixtures/locallangOnlyDefaultLanguage.xml b/tests/Unit/t3lib/l10n/parser/fixtures/locallangOnlyDefaultLanguage.xml
deleted file mode 100644 (file)
index 8a78841..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3locallang>
-       <meta type="array">
-               <description>Fixture labels for unit tests.</description>
-               <type>module</type>
-       </meta>
-       <data type="array">
-               <languageKey index="default" type="array">
-                       <label index="label1">This is label #1</label>
-                       <label index="label2">This is label #2</label>
-                       <label index="label3">This is label #3</label>
-               </languageKey>
-       </data>
-</T3locallang>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/fixtures/locallang_override.xlf b/tests/Unit/t3lib/l10n/parser/fixtures/locallang_override.xlf
deleted file mode 100644 (file)
index 568de52..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xliff version="1.0">
-       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests">
-               <header/>
-               <body>
-                       <trans-unit id="label1" xml:space="preserve">
-                               <source>This is my 1st label</source>
-                       </trans-unit>
-                       <trans-unit id="label2" xml:space="preserve">
-                               <source>This is my 2nd label</source>
-                       </trans-unit>
-               </body>
-       </file>
-</xliff>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/l10n/parser/fixtures/locallang_override.xml b/tests/Unit/t3lib/l10n/parser/fixtures/locallang_override.xml
deleted file mode 100644 (file)
index d719f38..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<T3locallang>
-       <meta type="array">
-               <description>Fixture labels for unit tests.</description>
-               <type>module</type>
-       </meta>
-       <data type="array">
-               <languageKey index="default" type="array">
-                       <label index="label1">This is my 1st label</label>
-                       <label index="label2">This is my 2nd label</label>
-               </languageKey>
-
-               <languageKey index="fr" type="array">
-                       <label index="label1">Ceci est mon 1er libellé</label>
-                       <label index="label3">Ceci est mon 3e libellé</label>
-               </languageKey>
-       </data>
-</T3locallang>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/class.t3lib_log_levelTest.php b/tests/Unit/t3lib/log/class.t3lib_log_levelTest.php
deleted file mode 100644 (file)
index 633545d..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for \TYPO3\CMS\Core\Log\Level.
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_LevelTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        */
-       public function isValidLevelValidatesValidLevels() {
-               $validLevels = array(0, 1, 2, 3, 4, 5, 6, 7);
-               foreach ($validLevels as $validLevel) {
-                       $this->assertTrue(\TYPO3\CMS\Core\Log\LogLevel::isValidLevel($validLevel));
-               }
-       }
-
-       /**
-        * @test
-        */
-       public function isValidLevelDoesNotValidateInvalidLevels() {
-               $invalidLevels = array(-1, 8, 1.5, 'string', array(), new stdClass(), FALSE, NULL);
-               foreach ($invalidLevels as $invalidLevel) {
-                       $this->assertFalse(\TYPO3\CMS\Core\Log\LogLevel::isValidLevel($invalidLevel));
-               }
-       }
-
-       /**
-        * Data provider or isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSo
-        */
-       public function isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSoDataProvider() {
-               return array(
-                       'negative integer' => array(-1),
-                       'higher level than expected' => array(8),
-                       'float' => array(1.5),
-                       'string' => array('string'),
-                       'array' => array(array()),
-                       'object' => array(new stdClass()),
-                       'boolean FALSE' => array(FALSE),
-                       'NULL' => array(NULL)
-               );
-       }
-
-       /**
-        * @test
-        * @dataprovider isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSoDataProvider
-        */
-       public function isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSo($inputValue) {
-               $this->setExpectedException('RangeException');
-               \TYPO3\CMS\Core\Log\LogLevel::validateLevel($inputValue);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/class.t3lib_log_loggerTest.php b/tests/Unit/t3lib/log/class.t3lib_log_loggerTest.php
deleted file mode 100644 (file)
index 47d06f4..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
- * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-require_once 'fixtures/class.t3lib_log_writer_fixture.php';
-require_once 'fixtures/class.t3lib_log_writer_failing.php';
-/**
- * Testcase for \TYPO3\CMS\Core\Log\Logger.
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @author Steffen Gebert <steffen.gebert@typo3.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_LoggerTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        */
-       public function getNameGetsLoggerName() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $this->assertSame('test.core.log', $logger->getName());
-       }
-
-       /**
-        * @test
-        */
-       public function loggerDoesNotLogRecordsLessCriticalThanLogLevel() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::ERROR, $writer);
-               // warning < error, thus must not be logged
-               $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
-               $this->assertAttributeEmpty('records', $writer);
-       }
-
-       /**
-        * @test
-        */
-       public function loggerReturnsItselfAfterLogging() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $writer);
-               $returnValue = $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $returnValue);
-       }
-
-       /**
-        * @test
-        */
-       public function loggerReturnsItselfAfterLoggingWithoutWriter() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $returnValue = $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $returnValue);
-       }
-
-       /**
-        * @test
-        */
-       public function loggerReturnsItselfAfterLoggingLessCritical() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::EMERGENCY, $writer);
-               $returnValue = $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $returnValue);
-       }
-
-       /**
-        * @test
-        */
-       public function loggerCallsProcessor() {
-               $component = 'test.core.log';
-               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
-               $message = 'test';
-               $logger = new \TYPO3\CMS\Core\Log\Logger($component);
-               /** @var $processor \TYPO3\CMS\Core\Log\Processor\Processor */
-               $processor = $this->getMock('TYPO3\\CMS\\Core\\Log\\Processor\\NullProcessor', array('processLogRecord'));
-               $processor->expects($this->once())->method('processLogRecord')->will($this->returnValue(new \TYPO3\CMS\Core\Log\LogRecord($component, $level, $message)));
-               $logger->addProcessor($level, $processor);
-               // we need a writer, otherwise we will not process log records
-               $logger->addWriter($level, new \TYPO3\CMS\Core\Log\Writer\NullWriter());
-               $logger->warning($message);
-       }
-
-       /**
-        * @test
-        */
-       public function loggerLogsRecord() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = $this->getMock('TYPO3\\CMS\\Core\\Log\\Writer\\NullWriter', array('writeLog'));
-               $writer->expects($this->once())->method('writeLog');
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $writer);
-               $logger->warning('test');
-       }
-
-       /**
-        * @test
-        */
-       public function loggerLogsRecordsAtLeastAsCriticalAsLogLevel() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
-               // notice == notice, thus must be logged
-               $logger->log(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, 'test message');
-               $this->assertAttributeNotEmpty('records', $writer);
-       }
-
-       /**
-        * @test
-        */
-       public function loggerLogsRecordsThroughShorthandMethodDataProvider() {
-               return array(
-                       array('emergency'),
-                       array('alert'),
-                       array('critical'),
-                       array('error'),
-                       array('warning'),
-                       array('notice'),
-                       array('info'),
-                       array('debug')
-               );
-       }
-
-       /**
-        * @test
-        * @param string $shorthandMethod
-        * @dataProvider loggerLogsRecordsThroughShorthandMethodDataProvider
-        */
-       public function loggerLogsRecordsThroughShorthandMethod($shorthandMethod) {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $writer);
-               call_user_func(array($logger, $shorthandMethod), 'test message');
-               $this->assertAttributeNotEmpty('records', $writer);
-       }
-
-       /**
-        * @test
-        */
-       public function loggerLogsRecordsMoreCriticalThanLogLevel() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
-               // warning > notice, thus must be logged
-               $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
-               $this->assertAttributeNotEmpty('records', $writer);
-       }
-
-       /**
-        * @test
-        */
-       public function addWriterAddsWriterToTheSpecifiedLevel() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
-               $writers = $logger->getWriters();
-               $this->assertContains($writer, $writers[\TYPO3\CMS\Core\Log\LogLevel::NOTICE]);
-       }
-
-       /**
-        * @test
-        */
-       public function addWriterAddsWriterAlsoToHigherLevelsThanSpecified() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new t3lib_log_writer_Fixture();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
-               $writers = $logger->getWriters();
-               $this->assertContains($writer, $writers[\TYPO3\CMS\Core\Log\LogLevel::EMERGENCY]);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/class.t3lib_log_logmanagerTest.php b/tests/Unit/t3lib/log/class.t3lib_log_logmanagerTest.php
deleted file mode 100644 (file)
index ad84f04..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
- * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for \TYPO3\CMS\Core\Log\LogManager.
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @author Steffen Gebert <steffen.gebert@typo3.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_LogManagerTest extends tx_phpunit_testcase {
-
-       /**
-        * Enable backup of global and system variables
-        *
-        * @var boolean
-        */
-       protected $backupGlobals = TRUE;
-
-       /**
-        * Exclude TYPO3_DB from backup/ restore of $GLOBALS
-        * because resource types cannot be handled during serializing
-        *
-        * @var array
-        */
-       protected $backupGlobalsBlacklist = array('TYPO3_DB');
-
-       /**
-        * @var \TYPO3\CMS\Core\Log\LogManager
-        */
-       protected $logManagerInstance = NULL;
-
-       public function setUp() {
-               $this->logManagerInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager');
-       }
-
-       public function tearDown() {
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->reset();
-       }
-
-       /**
-        * @test
-        */
-       public function logManagerReturnsLoggerWhenRequestedWithGetLogger() {
-               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $this->logManagerInstance->getLogger('test'));
-       }
-
-       /**
-        * @test
-        */
-       public function logManagerTurnsUnderScoreStyleLoggerNamesIntoDotStyleLoggerNames() {
-               $this->assertSame('test.a.b', $this->logManagerInstance->getLogger('test_a_b')->getName());
-       }
-
-       /**
-        * @test
-        */
-       public function managerReturnsSameLoggerOnRepeatedRequest() {
-               $loggerName = uniqid('test.core.log');
-               $this->logManagerInstance->registerLogger($loggerName);
-               $logger1 = $this->logManagerInstance->getLogger($loggerName);
-               $logger2 = $this->logManagerInstance->getLogger($loggerName);
-               $this->assertSame($logger1, $logger2);
-       }
-
-       /**
-        * @test
-        */
-       public function configuresLoggerWithConfiguredWriter() {
-               $component = 'test';
-               $writer = 'TYPO3\\CMS\\Core\\Log\\Writer\\NullWriter';
-               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
-               $GLOBALS['TYPO3_CONF_VARS']['LOG'][$component]['writerConfiguration'] = array(
-                       $level => array(
-                               $writer => array()
-                       )
-               );
-               /** @var $logger \TYPO3\CMS\Core\Log\Logger */
-               $logger = $this->logManagerInstance->getLogger($component);
-               $writers = $logger->getWriters();
-               $this->assertInstanceOf($writer, $writers[$level][0]);
-       }
-
-       /**
-        * @test
-        */
-       public function configuresLoggerWithConfiguredProcessor() {
-               $component = 'test';
-               $processor = 'TYPO3\\CMS\\Core\\Log\\Processor\\NullProcessor';
-               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
-               $GLOBALS['TYPO3_CONF_VARS']['LOG'][$component]['processorConfiguration'] = array(
-                       $level => array(
-                               $processor => array()
-                       )
-               );
-               /** @var $logger \TYPO3\CMS\Core\Log\Logger */
-               $logger = $this->logManagerInstance->getLogger($component);
-               $processors = $logger->getProcessors();
-               $this->assertInstanceOf($processor, $processors[$level][0]);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/class.t3lib_log_recordTest.php b/tests/Unit/t3lib/log/class.t3lib_log_recordTest.php
deleted file mode 100644 (file)
index c53ab25..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012-2012 Steffen Gebert (steffen.gebert@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for \TYPO3\CMS\Core\Log\LogRecord.
- *
- * @author Steffen Gebert <steffen.gebert@typo3.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_RecordTest extends tx_phpunit_testcase {
-
-       /**
-        * Returns a \TYPO3\CMS\Core\Log\LogRecord
-        *
-        * @param array $parameters Parameters to set in \TYPO3\CMS\Core\Log\LogRecord constructor.
-        * @return \TYPO3\CMS\Core\Log\LogRecord
-        */
-       protected function getRecord(array $parameters = array()) {
-               /** @var $record \TYPO3\CMS\Core\Log\LogRecord */
-               $record = new \TYPO3\CMS\Core\Log\LogRecord(!empty($parameters['component']) ? $parameters['component'] : 'test.core.log', !empty($parameters['level']) ? $parameters['level'] : \TYPO3\CMS\Core\Log\LogLevel::DEBUG, !empty($parameters['message']) ? $parameters['message'] : 'test message', !empty($parameters['data']) ? $parameters['data'] : array());
-               return $record;
-       }
-
-       /**
-        * @test
-        */
-       public function constructorSetsCorrectComponent() {
-               $component = 'test.core.log';
-               $record = $this->getRecord(array('component' => $component));
-               $this->assertEquals($component, $record->getComponent());
-       }
-
-       /**
-        * @test
-        */
-       public function constructorSetsCorrectLogLevel() {
-               $logLevel = \TYPO3\CMS\Core\Log\LogLevel::CRITICAL;
-               $record = $this->getRecord(array('level' => $logLevel));
-               $this->assertEquals($logLevel, $record->getLevel());
-       }
-
-       /**
-        * @test
-        */
-       public function constructorSetsCorrectMessage() {
-               $logMessage = 'test message';
-               $record = $this->getRecord(array('message' => $logMessage));
-               $this->assertEquals($logMessage, $record->getMessage());
-       }
-
-       /**
-        * @test
-        */
-       public function constructorSetsCorrectData() {
-               $dataArray = array(
-                       'foo' => 'bar'
-               );
-               $record = $this->getRecord(array('data' => $dataArray));
-               $this->assertEquals($dataArray, $record->getData());
-       }
-
-       /**
-        * @test
-        */
-       public function setComponentSetsComponent() {
-               $record = $this->getRecord();
-               $component = 'testcomponent';
-               $this->assertEquals($component, $record->setComponent($component)->getComponent());
-       }
-
-       /**
-        * @test
-        */
-       public function setLevelSetsLevel() {
-               $record = $this->getRecord();
-               $level = \TYPO3\CMS\Core\Log\LogLevel::EMERGENCY;
-               $this->assertEquals($level, $record->setLevel($level)->getLevel());
-       }
-
-       /**
-        * @test
-        * @expectedException RangeException
-        */
-       public function setLevelValidatesLevel() {
-               $record = $this->getRecord();
-               $record->setLevel(100);
-       }
-
-       /**
-        * @test
-        */
-       public function setMessageSetsMessage() {
-               $record = $this->getRecord();
-               $message = 'testmessage';
-               $this->assertEquals($message, $record->setMessage($message)->getMessage());
-       }
-
-       /**
-        * @test
-        */
-       public function setCreatedSetsCreated() {
-               $record = $this->getRecord();
-               $created = 123.45;
-               $this->assertEquals($created, $record->setCreated($created)->getCreated());
-       }
-
-       /**
-        * @test
-        */
-       public function setRequestIdSetsRequestId() {
-               $record = $this->getRecord();
-               $requestId = 'testrequestid';
-               $this->assertEquals($requestId, $record->setRequestId($requestId)->getRequestId());
-       }
-
-       /**
-        * @test
-        */
-       public function toArrayReturnsCorrectValues() {
-               $component = 'test.core.log';
-               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
-               $message = 'test message';
-               $data = array('foo' => 'bar');
-               /** @var $record \TYPO3\CMS\Core\Log\LogRecord */
-               $record = new \TYPO3\CMS\Core\Log\LogRecord($component, $level, $message, $data);
-               $recordArray = $record->toArray();
-               $this->assertEquals($component, $recordArray['component']);
-               $this->assertEquals($level, $recordArray['level']);
-               $this->assertEquals($message, $recordArray['message']);
-               $this->assertEquals($data, $recordArray['data']);
-       }
-
-       /**
-        * @test
-        */
-       public function toStringIncludesDataAsJson() {
-               $dataArray = array('foo' => 'bar');
-               $record = $this->getRecord(array('data' => $dataArray));
-               $this->assertContains(json_encode($dataArray), (string) $record);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/fixtures/class.t3lib_log_processor_fixture.php b/tests/Unit/t3lib/log/fixtures/class.t3lib_log_processor_fixture.php
deleted file mode 100644 (file)
index d2539b6..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Steffen Müller (typo3@t3node.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * A processor dedicated for testing
- *
- * @author Steffen Müller <typo3@t3node.com>
- */
-class t3lib_log_processor_Fixture extends \TYPO3\CMS\Core\Log\Processor\AbstractProcessor {
-
-       /**
-        * Processing the record
-        *
-        * @param \TYPO3\CMS\Core\Log\LogRecord $record
-        * @return \TYPO3\CMS\Core\Log\LogRecord
-        */
-       public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $record) {
-               return $record;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/fixtures/class.t3lib_log_writer_failing.php b/tests/Unit/t3lib/log/fixtures/class.t3lib_log_writer_failing.php
deleted file mode 100644 (file)
index 5b2b37d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Steffen Gebert (steffen.gebert@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * A log writer that always fails to write (for testing purposes ;-))
- *
- * @author Steffen Gebert <steffen.gebert@typo3.org>
- */
-class t3lib_log_writer_Failing implements \TYPO3\CMS\Core\Log\Writer\Writer {
-
-       /**
-        * Try to write the log entry - but throw an exception in our case
-        *
-        * @param \TYPO3\CMS\Core\Log\LogRecord $record
-        * @return \TYPO3\CMS\Core\Log\Writer\Writer|void
-        * @throws RuntimeException
-        */
-       public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
-               throw new RuntimeException('t3lib_log_writer_Failing failed');
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/fixtures/class.t3lib_log_writer_fixture.php b/tests/Unit/t3lib/log/fixtures/class.t3lib_log_writer_fixture.php
deleted file mode 100644 (file)
index 40acb96..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * A writer dedicated for testing
- *
- * @author Ingo Renner <ingo@typo3.org>
- */
-class t3lib_log_writer_Fixture extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
-
-       /**
-        * @var array
-        */
-       protected $records = array();
-
-       public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
-               $this->records[] = $record;
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_abstractTest.php b/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_abstractTest.php
deleted file mode 100644 (file)
index 09dd43f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Steffen Müller (typo3@t3node.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-require_once (__DIR__ . DIRECTORY_SEPARATOR) . '../fixtures/class.t3lib_log_processor_fixture.php';
-/**
- * Testcase for t3lib_log_processor_Abstract
- *
- * @author Steffen Müller <typo3@t3node.com>
- */
-class t3lib_log_processor_AbstractTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        * @expectedException InvalidArgumentException
-        */
-       public function processorRefusesInvalidConfigurationOptions() {
-               $invalidConfiguration = array(
-                       'foo' => 'bar'
-               );
-               $processor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_log_processor_Fixture', $invalidConfiguration);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_abstractmemoryTest.php b/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_abstractmemoryTest.php
deleted file mode 100644 (file)
index 794e45a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Steffen Müller (typo3@t3node.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor
- *
- * @author Steffen Müller <typo3@t3node.com>
- */
-class t3lib_log_processor_AbstractMemoryTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        * @todo Define visibility
-        */
-       public function getRealMemoryUsageGetsRealMemoryUsage() {
-               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
-               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
-               $this->assertAttributeEquals($processor->getRealMemoryUsage(), 'realMemoryUsage', $processor);
-       }
-
-       /**
-        * @test
-        * @todo Define visibility
-        */
-       public function setRealMemoryUsageSetsRealMemoryUsage() {
-               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
-               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
-               $processor->setRealMemoryUsage(FALSE);
-               $this->assertAttributeEquals(FALSE, 'realMemoryUsage', $processor);
-       }
-
-       /**
-        * @test
-        * @todo Define visibility
-        */
-       public function getFormatSizeGetsFormatSize() {
-               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
-               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
-               $this->assertAttributeEquals($processor->getFormatSize(), 'formatSize', $processor);
-       }
-
-       /**
-        * @test
-        * @todo Define visibility
-        */
-       public function setFormatSizeSetsFormatSize() {
-               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
-               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
-               $processor->setFormatSize(FALSE);
-               $this->assertAttributeEquals(FALSE, 'formatSize', $processor);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_introspectionTest.php b/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_introspectionTest.php
deleted file mode 100644 (file)
index 6e43f8f..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Steffen Müller (typo3@t3node.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for the web introspection processor.
- *
- * @author Steffen Müller <typo3@t3node.com>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_processor_IntrospectionTest extends tx_phpunit_testcase {
-
-       /**
-        * Tests if debug_backtrace values are added to LogRecord
-        * The debug_backtrace in \TYPO3\CMS\Core\Log\Processor\IntrospectionProcessor will always process a phpunit class.
-        * The result is unpredictable values. So we only test if values are not empty/0
-        *
-        * @test
-        */
-       public function introspectionProcessorAddsIntrospectionDataToLogRecord() {
-               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
-               $processor = new \TYPO3\CMS\Core\Log\Processor\IntrospectionProcessor();
-               $logRecord = $processor->processLogRecord($logRecord);
-               $this->assertNotEmpty($logRecord['data']['file'], 'Asserting that file name in debug_backtrace() is not empty');
-               $this->assertGreaterThan(0, $logRecord['data']['line'], 'Asserting that line numer in debug_backtrace() is greater than 0');
-               $this->assertNotEmpty($logRecord['data']['class'], 'Asserting that class in debug_backtrace() is not empty');
-               $this->assertNotEmpty($logRecord['data']['function'], 'Asserting that function in debug_backtrace() is not empty');
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_memoryPeakUsageTest.php b/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_memoryPeakUsageTest.php
deleted file mode 100644 (file)
index 0699bf2..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Steffen Müller (typo3@t3node.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for the memoryPeakUsage log processor.
- *
- * @author Steffen Müller <typo3@t3node.com>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_processor_memoryPeakUsageTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        */
-       public function memoryPeakUsagePRocessorAddsMemoryPeakUsageDataToLogRecord() {
-               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
-               $processor = new \TYPO3\CMS\Core\Log\Processor\MemoryPeakUsageProcessor();
-               $logRecord = $processor->processLogRecord($logRecord);
-               $this->assertArrayHasKey('memoryPeakUsage', $logRecord['data']);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_memoryUsageTest.php b/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_memoryUsageTest.php
deleted file mode 100644 (file)
index ef49641..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Steffen Müller (typo3@t3node.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for the memoryUsage log processor.
- *
- * @author Steffen Müller <typo3@t3node.com>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_processor_memoryUsageTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        */
-       public function memoryUsagePRocessorAddsMemoryUsageDataToLogRecord() {
-               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
-               $processor = new \TYPO3\CMS\Core\Log\Processor\MemoryUsageProcessor();
-               $logRecord = $processor->processLogRecord($logRecord);
-               $this->assertArrayHasKey('memoryUsage', $logRecord['data']);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_processorTest.php b/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_processorTest.php
deleted file mode 100644 (file)
index 7af0618..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Ingo Renner (ingo@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for log processors.
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_processor_ProcessorTest extends tx_phpunit_testcase implements \TYPO3\CMS\Core\Log\Processor\Processor {
-
-       /**
-        * @var bool
-        */
-       public $processorCalled = FALSE;
-
-       /**
-        * Processes a log record and adds server data.
-        *
-        * @param \TYPO3\CMS\Core\Log\LogRecord $logRecord The log record to process
-        * @return \TYPO3\CMS\Core\Log\LogRecord The processed log record with addtional data
-        */
-       public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $logRecord) {
-               $this->processorCalled = TRUE;
-               return $logRecord;
-       }
-
-       /**
-        * @test
-        */
-       public function loggerExecutesProcessors() {
-               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
-               $writer = new \TYPO3\CMS\Core\Log\Writer\NullWriter();
-               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
-               $logger->addWriter($level, $writer);
-               $logger->addProcessor($level, $this);
-               $logger->warning('test');
-               $this->assertTrue($this->processorCalled);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_webTest.php b/tests/Unit/t3lib/log/processor/class.t3lib_log_processor_webTest.php
deleted file mode 100644 (file)
index 440e86d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2012 Ingo Renner (ingo@typo3.org)
- * (c) 2012 Steffen Müller (typo3@t3node.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for the web log processor.
- *
- * @author Ingo Renner <ingo@typo3.org>
- * @author Steffen Müller <typo3@t3node.com>
- * @package TYPO3
- * @subpackage t3lib
- */
-class t3lib_log_processor_WebTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        */
-       public function webProcessorAddsWebDataToLogRecord() {
-               $environmentVariables = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('_ARRAY');
-               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
-               $processor = new \TYPO3\CMS\Core\Log\Processor\WebProcessor();
-               $logRecord = $processor->processLogRecord($logRecord);
-               foreach ($environmentVariables as $key => $value) {
-                       $this->assertEquals($value, $logRecord['data'][$key]);
-               }
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/writer/class.t3lib_log_writer_abstractTest.php b/tests/Unit/t3lib/log/writer/class.t3lib_log_writer_abstractTest.php
deleted file mode 100644 (file)
index e4a32c3..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-require_once (__DIR__ . DIRECTORY_SEPARATOR) . '../fixtures/class.t3lib_log_writer_fixture.php';
-/**
- * Testcase for \TYPO3\CMS\Core\Log\Writer\AbstractWriter
- *
- * @author Steffen Gebert <steffen.gebert@typo3.org>
- */
-class t3lib_log_writer_AbstractTest extends tx_phpunit_testcase {
-
-       /**
-        * @test
-        * @expectedException InvalidArgumentException
-        */
-       public function refusesInvalidConfigurationOptions() {
-               $invalidConfiguration = array(
-                       'foo' => 'bar'
-               );
-               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_log_writer_Fixture', $invalidConfiguration);
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/writer/class.t3lib_log_writer_databaseTest.php b/tests/Unit/t3lib/log/writer/class.t3lib_log_writer_databaseTest.php
deleted file mode 100644 (file)
index fe7767a..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for \TYPO3\CMS\Core\Log\Writer\DatabaseWriter
- *
- * @author Steffen Gebert <steffen.gebert@typo3.org>
- */
-class t3lib_log_writer_DatabaseTest extends tx_phpunit_testcase {
-
-       /**
-        * Backup and restore of the $GLOBALS array.
-        *
-        * @var boolean
-        */
-       protected $backupGlobalsArray = array();
-
-       /**
-        * Mock object of t3lib_db
-        *
-        * @var PHPUnit_Framework_MockObject_MockObject
-        */
-       private $databaseStub;
-
-       /**
-        * Create a new database mock object for every test
-        * and backup the original global database object.
-        *
-        * @return void
-        */
-       public function setUp() {
-               $this->backupGlobalsArray['TYPO3_DB'] = $GLOBALS['TYPO3_DB'];
-               $this->databaseStub = $this->setUpAndReturnDatabaseStub();
-       }
-
-       /**
-        * Restore global database object.
-        *
-        * @return void
-        */
-       protected function tearDown() {
-               $GLOBALS['TYPO3_DB'] = $this->backupGlobalsArray['TYPO3_DB'];
-       }
-
-       //////////////////////
-       // Utility functions
-       //////////////////////
-       /**
-        * Set up the stub to be able to get the result of the prepared statement.
-        *
-        * @return PHPUnit_Framework_MockObject_MockObject
-        */
-       private function setUpAndReturnDatabaseStub() {
-               $databaseLink = $GLOBALS['TYPO3_DB']->link;
-               $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array('exec_INSERTquery'), array(), '', FALSE, FALSE);
-               $GLOBALS['TYPO3_DB']->link = $databaseLink;
-               return $GLOBALS['TYPO3_DB'];
-       }
-
-       /**
-        * Creates a test logger
-        *
-        * @return \TYPO3\CMS\Core\Log\Logger
-        */
-       protected function createLogger() {
-               $loggerName = uniqid('test.core.datbaseWriter');
-               /** @var \TYPO3\CMS\Core\Log\Logger $logger */
-               $logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger($loggerName);
-               return $logger;
-       }
-
-       /**
-        * Creates a database writer
-        *
-        * @return \TYPO3\CMS\Core\Log\Writer\DatabaseWriter
-        */
-       protected function createWriter() {
-               /** @var \TYPO3\CMS\Core\Log\Writer\DatabaseWriter $writer */
-               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\DatabaseWriter');
-               return $writer;
-       }
-
-       /**
-        * @test
-        */
-       public function setLogTableSetsLogTable() {
-               $logTable = uniqid('logtable_');
-               $this->assertSame($logTable, $this->createWriter()->setLogTable($logTable)->getLogTable());
-       }
-
-       /**
-        * @return array
-        */
-       public function writerLogsToDatabaseDataProvider() {
-               $simpleRecord = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', 'test.core.databaseWriter.simpleRecord', \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test entry');
-               $recordWithData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', 'test.core.databaseWriter.recordWithData', \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test entry with data', array('foo' => array('bar' => 'baz')));
-               return array(
-                       'simple record' => array($simpleRecord),
-                       'record with data' => array($recordWithData)
-               );
-       }
-
-       /**
-        * @test
-        * @param \TYPO3\CMS\Core\Log\LogRecord $record Record Test Data
-        * @dataProvider writerLogsToDatabaseDataProvider
-        */
-       public function writerLogsToDatabase(\TYPO3\CMS\Core\Log\LogRecord $record) {
-               $logger = $this->createLogger();
-               $databaseWriter = $this->createWriter();
-               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $databaseWriter);
-               $this->databaseStub->expects($this->once())->method('exec_INSERTquery');
-               $logger->log($record->getLevel(), $record->getMessage());
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/tests/Unit/t3lib/log/writer/class.t3lib_log_writer_fileTest.php b/tests/Unit/t3lib/log/writer/class.t3lib_log_writer_fileTest.php
deleted file mode 100644 (file)
index c25a201..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/***************************************************************
- * Copyright notice
- *
- * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * Testcase for \TYPO3\CMS\Core\Log\Writer\FileWriter
- *
- * @author Steffen Gebert <steffen.gebert@typo3.org>
- */
-class t3lib_log_writer_FileTest extends tx_phpunit_testcase {
-
-       /**
-        * @var string
-        */
-       protected $logFileDirectory = 'Log';
-
-       /**
-        * @var string
-        */
-       protected $logFileName = 'test.log';
-
-       protected function setUpVfsStream() {
-               if (!class_exists('vfsStream')) {
-                       $this->markTestSkipped('File backend tests are not available with this phpunit version.');
-               }
-               vfsStream::setup('LogRoot');
-       }
-
-       /**
-        * Creates a test logger
-        *
-        * @param string $name
-        * @internal param string $component Component key
-        * @return \TYPO3\CMS\Core\Log\Logger
-        */
-       protected function createLogger($name = '') {
-               if (empty($name)) {
-                       $name = uniqid('test.core.log.');
-               }
-               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->registerLogger($name);
-               /** @var \TYPO3\CMS\Core\Log\Logger $logger */
-               $logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger($name);
-               return $logger;
-       }
-
-       /**
-        * Creates a file writer
-        *
-        * @return \TYPO3\CMS\Core\Log\Writer\FileWriter
-        */
-       protected function createWriter() {
-               /** @var \TYPO3\CMS\Core\Log\Writer\FileWriter $writer */
-               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter', array(
-                       'logFile' => (('vfs://LogRoot/' . $this->logFileDirectory) . '/') . $this->logFileName
-               ));
-               return $writer;
-       }
-
-       protected function getDefaultFileName() {
-               return (('vfs://LogRoot/' . $this->logFileDirectory) . '/') . $this->logFileName;
-       }
-
-       /**
-        * @test
-        */
-       public function setLogFileSetsLogFile() {
-               $this->setUpVfsStream();
-               vfsStream::newFile($this->logFileName)->at(vfsStreamWrapper::getRoot());
-               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter');
-               $writer->setLogFile($this->getDefaultFileName());
-               $this->assertAttributeEquals($this->getDefaultFileName(), 'logFile', $writer);
-       }
-
-       /**
-        * @test
-        * @expectedException InvalidArgumentException
-        */
-       public function setLogFileRefusesIllegalPath() {
-               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter');
-               $writer->setLogFile('/tmp/typo3.log');
-       }
-
-       /**
-        * @test
-        */
-       public function createsLogFileDirectory() {
-               $this->setUpVfsStream();
-               $this->createWriter();
-               $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild($this->logFileDirectory));
-       }
-
-       /**
-        * @test
-        */
-       public function createsLogFile() {
-               $this->setUpVfsStream();
-               $this->createWriter();
-               $this->assertTrue(vfsStreamWrapper::getRoot()->getChild($this->logFileDirectory)->hasChild($this->logFileName));
-       }
-
-       /**
-        * @return array
-        */
-       public function logsToFileDataProvider() {
-               $simpleRecord = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', uniqid('test.core.log.fileWriter.simpleRecord.'), \TYPO3\CMS\Core\Log\LogLevel::INFO, 'test record');
-               $recordWithData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', uniqid('test.core.log.fileWriter.recordWithData.'), \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test record with data', array('foo' => array('bar' => 'baz')));
-               return array(
-                       'simple record' => array($simpleRecord, (string) $simpleRecord),
-                       'record with data' => array($recordWithData, (string) $recordWithData)
-               );
-       }
-
-       /**
-        * @test
-        * @param \TYPO3\CMS\Core\Log\LogRecord $record Record Test Data
-        * @param string $expectedResult Needle
-        * @dataProvider logsToFileDataProvider
-        */
-       public function logsToFile(\TYPO3\CMS\Core\Log\LogRecord $record, $expectedResult) {
-               $this->setUpVfsStream();
-               $this->createWriter()->writeLog($record);
-               $logFileContents = file_get_contents($this->getDefaultFileName());
-               $logFileContents = trim($logFileContents);
-               $expectedResult = trim($expectedResult);
-               $this->assertEquals($logFileContents, $expectedResult);
-       }
-
-       /**
-        * @test
-        */
-       public function createsHtaccessForNewDirectory() {
-               $this->setUpVfsStream();
-               $directory = uniqid('Log');
-               $logFile = (('vfs://LogRoot/' . $directory) . '/') . $this->logFileName;
-               $this->createWriter()->setLogFile($logFile);
-               $this->assertFileExists(('vfs://LogRoot/' . $directory) . '/.htaccess');
-       }
-
-       /**
-        * @test
-        */
-       public function createsNoHtaccessForExistingDirectory() {
-               $this->setUpVfsStream();
-               $directory = uniqid('Log');
-               // create a directory
-               vfsStreamWrapper::getRoot()->addChild(new vfsStreamDirectory($directory));
-               $logFile = (('vfs://LogRoot/' . $directory) . '/') . $this->logFileName;
-               $this->assertTrue(is_dir('vfs://LogRoot/' . $directory));
-               $this->createWriter()->setLogFile($logFile);
-               $this->assertFileNotExists(('vfs://LogRoot/' . $directory) . '/.htaccess');
-       }
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/fr.locallang.xlf b/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/fr.locallang.xlf
new file mode 100644 (file)
index 0000000..0401714
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests" target-language="fr">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is label #1</source>
+                               <target>Ceci est le libellé no. 1</target>
+                       </trans-unit>
+                       <trans-unit id="label2" xml:space="preserve">
+                               <source>This is label #2</source>
+                               <target>Ceci est le libellé no. 2</target>
+                       </trans-unit>
+                       <trans-unit id="label3" xml:space="preserve">
+                               <source>This is label #3</source>
+                               <target>Ceci est le libellé no. 3</target>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/fr.locallang_override.xlf b/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/fr.locallang_override.xlf
new file mode 100644 (file)
index 0000000..ccf1920
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests" target-language="fr">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is label #1</source>
+                               <target>Ceci est mon 1er libellé</target>
+                       </trans-unit>
+                       <trans-unit id="label3" xml:space="preserve">
+                               <source>This is label #3</source>
+                               <target>Ceci est mon 3e libellé</target>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang.xlf b/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang.xlf
new file mode 100644 (file)
index 0000000..06c5639
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is label #1</source>
+                       </trans-unit>
+                       <trans-unit id="label2" xml:space="preserve">
+                               <source>This is label #2</source>
+                       </trans-unit>
+                       <trans-unit id="label3" xml:space="preserve">
+                               <source>This is label #3</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang.xml b/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang.xml
new file mode 100644 (file)
index 0000000..a5d7543
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Fixture labels for unit tests.</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="label1">This is label #1</label>
+                       <label index="label2">This is label #2</label>
+                       <label index="label3">This is label #3</label>
+               </languageKey>
+
+               <languageKey index="fr" type="array">
+                       <label index="label1">Ceci est le libellé no. 1</label>
+                       <label index="label2">Ceci est le libellé no. 2</label>
+                       <label index="label3">Ceci est le libellé no. 3</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallangOnlyDefaultLanguage.xml b/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallangOnlyDefaultLanguage.xml
new file mode 100644 (file)
index 0000000..8a78841
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Fixture labels for unit tests.</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="label1">This is label #1</label>
+                       <label index="label2">This is label #2</label>
+                       <label index="label3">This is label #3</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang_override.xlf b/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang_override.xlf
new file mode 100644 (file)
index 0000000..568de52
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xliff version="1.0">
+       <file source-language="en" datatype="plaintext" original="messages" date="2011-12-21T11:57:33Z" product-name="tests">
+               <header/>
+               <body>
+                       <trans-unit id="label1" xml:space="preserve">
+                               <source>This is my 1st label</source>
+                       </trans-unit>
+                       <trans-unit id="label2" xml:space="preserve">
+                               <source>This is my 2nd label</source>
+                       </trans-unit>
+               </body>
+       </file>
+</xliff>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang_override.xml b/typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang_override.xml
new file mode 100644 (file)
index 0000000..d719f38
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Fixture labels for unit tests.</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="label1">This is my 1st label</label>
+                       <label index="label2">This is my 2nd label</label>
+               </languageKey>
+
+               <languageKey index="fr" type="array">
+                       <label index="label1">Ceci est mon 1er libellé</label>
+                       <label index="label3">Ceci est mon 3e libellé</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php b/typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php
new file mode 100644 (file)
index 0000000..d3271f4
--- /dev/null
@@ -0,0 +1,164 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Localization\Parser;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for class \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser.
+ *
+ * @author Xavier Perseguers <xavier@typo3.org>
+ * @package TYPO3
+ */
+class LocallangXmlParserTest extends \tx_phpunit_testcase {
+
+       /**
+        * @var \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser
+        */
+       protected $parser;
+
+       /**
+        * @var array
+        */
+       protected $locallangXMLOverride;
+
+       /**
+        * @var string
+        */
+       protected $l10nPriority;
+
+       /**
+        * @var array
+        */
+       protected $llxmlFileNames;
+
+       /**
+        * Prepares the environment before running a test.
+        */
+       public function setUp() {
+                       // Backup locallangXMLOverride and localization format priority
+               $this->locallangXMLOverride = $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
+               $this->l10nPriority = $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'];
+               $this->parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
+
+                       // We have to take the whole relative path as otherwise this test fails on Windows systems
+               $fixturePath = PATH_site . 'typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/';
+               $this->llxmlFileNames = array(
+                       'locallang' => $fixturePath . 'locallang.xml',
+                       'locallang_override' => $fixturePath . 'locallang_override.xml',
+                       'locallangOnlyDefaultLanguage' => $fixturePath . 'locallangOnlyDefaultLanguage.xml'
+               );
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = 'xml';
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
+                       // Clear localization cache
+               $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush();
+       }
+
+       /**
+        * Cleans up the environment after running a test.
+        */
+       public function tearDown() {
+               unset($this->parser);
+                       // Restore locallangXMLOverride and localization format priority
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = $this->locallangXMLOverride;
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = $this->l10nPriority;
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
+       }
+
+       /**
+        * @test
+        */
+       public function canParseLlxmlInEnglish() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallang'], 'default');
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+               $expectedLabels = array(
+                       'label1' => 'This is label #1',
+                       'label2' => 'This is label #2',
+                       'label3' => 'This is label #3'
+               );
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['default'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canParseLlxmlInFrench() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallang'], 'fr');
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+               $expectedLabels = array(
+                       'label1' => 'Ceci est le libellé no. 1',
+                       'label2' => 'Ceci est le libellé no. 2',
+                       'label3' => 'Ceci est le libellé no. 3'
+               );
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canParseLlxmlInFrenchAndReturnsDefaultLabelsIfNoTranslationIsFound() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->llxmlFileNames['locallangOnlyDefaultLanguage'], 'fr');
+               $expectedLabels = array(
+                       'label1' => 'This is label #1',
+                       'label2' => 'This is label #2',
+                       'label3' => 'This is label #3'
+               );
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canOverrideLlxml() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->llxmlFileNames['locallang']][] = $this->llxmlFileNames['locallang_override'];
+               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->llxmlFileNames['locallang'], 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->llxmlFileNames['locallang'], 'fr'));
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+               $expectedLabels = array(
+                       'default' => array(
+                               'label1' => 'This is my 1st label',
+                               'label2' => 'This is my 2nd label',
+                               'label3' => 'This is label #3'
+                       ),
+                       'fr' => array(
+                               'label1' => 'Ceci est mon 1er libellé',
+                               'label2' => 'Ceci est le libellé no. 2',
+                               'label3' => 'Ceci est mon 3e libellé'
+                       )
+               );
+               foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) {
+                       foreach ($expectedLanguageLabels as $key => $expectedLabel) {
+                               $this->assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']);
+                       }
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php b/typo3/sysext/core/Tests/Unit/Localization/Parser/XliffParserTest.php
new file mode 100644 (file)
index 0000000..a0226fc
--- /dev/null
@@ -0,0 +1,170 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Localization\Parser;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011 Xavier Perseguers <xavier@typo3.org>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for class \TYPO3\CMS\Core\Localization\Parser\XliffParser.
+ *
+ * @author Xavier Perseguers <xavier@typo3.org>
+ * @package TYPO3
+ */
+class XliffParserTest extends \tx_phpunit_testcase {
+
+       /**
+        * @var \TYPO3\CMS\Core\Localization\Parser\XliffParser
+        */
+       protected $parser;
+
+       /**
+        * @var array
+        */
+       protected $locallangXMLOverride;
+
+       /**
+        * @var string
+        */
+       protected $l10nPriority;
+
+       /**
+        * @var array
+        */
+       protected $xliffFileNames;
+
+       /**
+        * Prepares the environment before running a test.
+        */
+       public function setUp() {
+                       // Backup locallangXMLOverride and localization format priority
+               $this->locallangXMLOverride = $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'];
+               $this->l10nPriority = $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'];
+               $this->parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\XliffParser');
+
+                       // We have to take the whole relative path as otherwise this test fails on Windows systems
+               $fixturePath = PATH_site . 'typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/';
+               $this->xliffFileNames = array(
+                       'locallang' => $fixturePath . 'locallang.xlf',
+                       'locallang_override' => $fixturePath . 'locallang_override.xlf',
+                       'locallang_override_fr' => $fixturePath . 'fr.locallang_override.xlf'
+               );
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = 'xlf';
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
+                       // Clear localization cache
+               $GLOBALS['typo3CacheManager']->getCache('t3lib_l10n')->flush();
+       }
+
+       /**
+        * Cleans up the environment after running a test.
+        */
+       public function tearDown() {
+               unset($this->parser);
+                       // Restore locallangXMLOverride and localization format priority
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = $this->locallangXMLOverride;
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = $this->l10nPriority;
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\LanguageStore')->initialize();
+       }
+
+       /**
+        * @test
+        */
+       public function canParseXliffInEnglish() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->xliffFileNames['locallang'], 'default');
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+               $expectedLabels = array(
+                       'label1' => 'This is label #1',
+                       'label2' => 'This is label #2',
+                       'label3' => 'This is label #3'
+               );
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['default'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canParseXliffInFrench() {
+               $LOCAL_LANG = $this->parser->getParsedData($this->xliffFileNames['locallang'], 'fr');
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+               $expectedLabels = array(
+                       'label1' => 'Ceci est le libellé no. 1',
+                       'label2' => 'Ceci est le libellé no. 2',
+                       'label3' => 'Ceci est le libellé no. 3'
+               );
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function canOverrideXliff() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override'];
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
+               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'fr'));
+               $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+               $expectedLabels = array(
+                       'default' => array(
+                               'label1' => 'This is my 1st label',
+                               'label2' => 'This is my 2nd label',
+                               'label3' => 'This is label #3'
+                       ),
+                       'fr' => array(
+                               'label1' => 'Ceci est mon 1er libellé',
+                               'label2' => 'Ceci est le libellé no. 2',
+                               'label3' => 'Ceci est mon 3e libellé'
+                       )
+               );
+               foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) {
+                       foreach ($expectedLanguageLabels as $key => $expectedLabel) {
+                               $this->assertEquals($expectedLabel, $LOCAL_LANG[$languageKey][$key][0]['target']);
+                       }
+               }
+       }
+
+       /**
+        * This test will make sure method t3lib_div::llXmlAutoFileName() will not prefix twice the
+        * language key to the localization file.
+        *
+        * @test
+        */
+       public function canOverrideXliffWithFrenchOnly() {
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['fr'][$this->xliffFileNames['locallang']][] = $this->xliffFileNames['locallang_override_fr'];
+               $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($this->xliffFileNames['locallang'], 'fr');
+               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+               $expectedLabels = array(
+                       'label1' => 'Ceci est mon 1er libellé',
+                       'label2' => 'Ceci est le libellé no. 2',
+                       'label3' => 'Ceci est mon 3e libellé'
+               );
+               foreach ($expectedLabels as $key => $expectedLabel) {
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Fixtures/ProcessorFixture.php b/typo3/sysext/core/Tests/Unit/Log/Fixtures/ProcessorFixture.php
new file mode 100644 (file)
index 0000000..b6ff079
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Fixtures;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Steffen Müller (typo3@t3node.com)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * A processor dedicated for testing
+ *
+ * @author Steffen Müller <typo3@t3node.com>
+ */
+class ProcessorFixture extends \TYPO3\CMS\Core\Log\Processor\AbstractProcessor {
+
+       /**
+        * Processing the record
+        *
+        * @param \TYPO3\CMS\Core\Log\LogRecord $record
+        * @return \TYPO3\CMS\Core\Log\LogRecord
+        */
+       public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $record) {
+               return $record;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFailing.php b/typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFailing.php
new file mode 100644 (file)
index 0000000..2d33b93
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Fixtures;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Steffen Gebert (steffen.gebert@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * A log writer that always fails to write (for testing purposes ;-))
+ *
+ * @author Steffen Gebert <steffen.gebert@typo3.org>
+ */
+class WriterFailing implements \TYPO3\CMS\Core\Log\Writer\Writer {
+
+       /**
+        * Try to write the log entry - but throw an exception in our case
+        *
+        * @param \TYPO3\CMS\Core\Log\LogRecord $record
+        * @return \TYPO3\CMS\Core\Log\Writer\Writer|void
+        * @throws RuntimeException
+        */
+       public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
+               throw new RuntimeException('t3lib_log_writer_Failing failed');
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFixture.php b/typo3/sysext/core/Tests/Unit/Log/Fixtures/WriterFixture.php
new file mode 100644 (file)
index 0000000..48b6d4e
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Fixtures;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * A writer dedicated for testing
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ */
+class WriterFixture extends \TYPO3\CMS\Core\Log\Writer\AbstractWriter {
+
+       /**
+        * @var array
+        */
+       protected $records = array();
+
+       public function writeLog(\TYPO3\CMS\Core\Log\LogRecord $record) {
+               $this->records[] = $record;
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/LogLevelTest.php b/typo3/sysext/core/Tests/Unit/Log/LogLevelTest.php
new file mode 100644 (file)
index 0000000..8ec5a85
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\Level.
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class LevelTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        */
+       public function isValidLevelValidatesValidLevels() {
+               $validLevels = array(0, 1, 2, 3, 4, 5, 6, 7);
+               foreach ($validLevels as $validLevel) {
+                       $this->assertTrue(\TYPO3\CMS\Core\Log\LogLevel::isValidLevel($validLevel));
+               }
+       }
+
+       /**
+        * @test
+        */
+       public function isValidLevelDoesNotValidateInvalidLevels() {
+               $invalidLevels = array(-1, 8, 1.5, 'string', array(), new \stdClass(), FALSE, NULL);
+               foreach ($invalidLevels as $invalidLevel) {
+                       $this->assertFalse(\TYPO3\CMS\Core\Log\LogLevel::isValidLevel($invalidLevel));
+               }
+       }
+
+       /**
+        * Data provider or isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSo
+        */
+       public function isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSoDataProvider() {
+               return array(
+                       'negative integer' => array(-1),
+                       'higher level than expected' => array(8),
+                       'float' => array(1.5),
+                       'string' => array('string'),
+                       'array' => array(array()),
+                       'object' => array(new stdClass()),
+                       'boolean FALSE' => array(FALSE),
+                       'NULL' => array(NULL)
+               );
+       }
+
+       /**
+        * @test
+        * @dataprovider isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSoDataProvider
+        */
+       public function isValidLevelThrowsExceptionOnInvalidLevelIfAskedToDoSo($inputValue) {
+               $this->setExpectedException('RangeException');
+               \TYPO3\CMS\Core\Log\LogLevel::validateLevel($inputValue);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/LogManagerTest.php b/typo3/sysext/core/Tests/Unit/Log/LogManagerTest.php
new file mode 100644 (file)
index 0000000..78a1961
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
+ * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\LogManager.
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @author Steffen Gebert <steffen.gebert@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class LogManagerTest extends \tx_phpunit_testcase {
+
+       /**
+        * Enable backup of global and system variables
+        *
+        * @var boolean
+        */
+       protected $backupGlobals = TRUE;
+
+       /**
+        * Exclude TYPO3_DB from backup/ restore of $GLOBALS
+        * because resource types cannot be handled during serializing
+        *
+        * @var array
+        */
+       protected $backupGlobalsBlacklist = array('TYPO3_DB');
+
+       /**
+        * @var \TYPO3\CMS\Core\Log\LogManager
+        */
+       protected $logManagerInstance = NULL;
+
+       public function setUp() {
+               $this->logManagerInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager');
+       }
+
+       public function tearDown() {
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->reset();
+       }
+
+       /**
+        * @test
+        */
+       public function logManagerReturnsLoggerWhenRequestedWithGetLogger() {
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $this->logManagerInstance->getLogger('test'));
+       }
+
+       /**
+        * @test
+        */
+       public function logManagerTurnsUnderScoreStyleLoggerNamesIntoDotStyleLoggerNames() {
+               $this->assertSame('test.a.b', $this->logManagerInstance->getLogger('test_a_b')->getName());
+       }
+
+       /**
+        * @test
+        */
+       public function managerReturnsSameLoggerOnRepeatedRequest() {
+               $loggerName = uniqid('test.core.log');
+               $this->logManagerInstance->registerLogger($loggerName);
+               $logger1 = $this->logManagerInstance->getLogger($loggerName);
+               $logger2 = $this->logManagerInstance->getLogger($loggerName);
+               $this->assertSame($logger1, $logger2);
+       }
+
+       /**
+        * @test
+        */
+       public function configuresLoggerWithConfiguredWriter() {
+               $component = 'test';
+               $writer = 'TYPO3\\CMS\\Core\\Log\\Writer\\NullWriter';
+               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
+               $GLOBALS['TYPO3_CONF_VARS']['LOG'][$component]['writerConfiguration'] = array(
+                       $level => array(
+                               $writer => array()
+                       )
+               );
+               /** @var $logger \TYPO3\CMS\Core\Log\Logger */
+               $logger = $this->logManagerInstance->getLogger($component);
+               $writers = $logger->getWriters();
+               $this->assertInstanceOf($writer, $writers[$level][0]);
+       }
+
+       /**
+        * @test
+        */
+       public function configuresLoggerWithConfiguredProcessor() {
+               $component = 'test';
+               $processor = 'TYPO3\\CMS\\Core\\Log\\Processor\\NullProcessor';
+               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
+               $GLOBALS['TYPO3_CONF_VARS']['LOG'][$component]['processorConfiguration'] = array(
+                       $level => array(
+                               $processor => array()
+                       )
+               );
+               /** @var $logger \TYPO3\CMS\Core\Log\Logger */
+               $logger = $this->logManagerInstance->getLogger($component);
+               $processors = $logger->getProcessors();
+               $this->assertInstanceOf($processor, $processors[$level][0]);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/LogRecordTest.php b/typo3/sysext/core/Tests/Unit/Log/LogRecordTest.php
new file mode 100644 (file)
index 0000000..13c8f00
--- /dev/null
@@ -0,0 +1,168 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012-2012 Steffen Gebert (steffen.gebert@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\LogRecord.
+ *
+ * @author Steffen Gebert <steffen.gebert@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class RecordTest extends \tx_phpunit_testcase {
+
+       /**
+        * Returns a \TYPO3\CMS\Core\Log\LogRecord
+        *
+        * @param array $parameters Parameters to set in \TYPO3\CMS\Core\Log\LogRecord constructor.
+        * @return \TYPO3\CMS\Core\Log\LogRecord
+        */
+       protected function getRecord(array $parameters = array()) {
+               /** @var $record \TYPO3\CMS\Core\Log\LogRecord */
+               $record = new \TYPO3\CMS\Core\Log\LogRecord(!empty($parameters['component']) ? $parameters['component'] : 'test.core.log', !empty($parameters['level']) ? $parameters['level'] : \TYPO3\CMS\Core\Log\LogLevel::DEBUG, !empty($parameters['message']) ? $parameters['message'] : 'test message', !empty($parameters['data']) ? $parameters['data'] : array());
+               return $record;
+       }
+
+       /**
+        * @test
+        */
+       public function constructorSetsCorrectComponent() {
+               $component = 'test.core.log';
+               $record = $this->getRecord(array('component' => $component));
+               $this->assertEquals($component, $record->getComponent());
+       }
+
+       /**
+        * @test
+        */
+       public function constructorSetsCorrectLogLevel() {
+               $logLevel = \TYPO3\CMS\Core\Log\LogLevel::CRITICAL;
+               $record = $this->getRecord(array('level' => $logLevel));
+               $this->assertEquals($logLevel, $record->getLevel());
+       }
+
+       /**
+        * @test
+        */
+       public function constructorSetsCorrectMessage() {
+               $logMessage = 'test message';
+               $record = $this->getRecord(array('message' => $logMessage));
+               $this->assertEquals($logMessage, $record->getMessage());
+       }
+
+       /**
+        * @test
+        */
+       public function constructorSetsCorrectData() {
+               $dataArray = array(
+                       'foo' => 'bar'
+               );
+               $record = $this->getRecord(array('data' => $dataArray));
+               $this->assertEquals($dataArray, $record->getData());
+       }
+
+       /**
+        * @test
+        */
+       public function setComponentSetsComponent() {
+               $record = $this->getRecord();
+               $component = 'testcomponent';
+               $this->assertEquals($component, $record->setComponent($component)->getComponent());
+       }
+
+       /**
+        * @test
+        */
+       public function setLevelSetsLevel() {
+               $record = $this->getRecord();
+               $level = \TYPO3\CMS\Core\Log\LogLevel::EMERGENCY;
+               $this->assertEquals($level, $record->setLevel($level)->getLevel());
+       }
+
+       /**
+        * @test
+        * @expectedException RangeException
+        */
+       public function setLevelValidatesLevel() {
+               $record = $this->getRecord();
+               $record->setLevel(100);
+       }
+
+       /**
+        * @test
+        */
+       public function setMessageSetsMessage() {
+               $record = $this->getRecord();
+               $message = 'testmessage';
+               $this->assertEquals($message, $record->setMessage($message)->getMessage());
+       }
+
+       /**
+        * @test
+        */
+       public function setCreatedSetsCreated() {
+               $record = $this->getRecord();
+               $created = 123.45;
+               $this->assertEquals($created, $record->setCreated($created)->getCreated());
+       }
+
+       /**
+        * @test
+        */
+       public function setRequestIdSetsRequestId() {
+               $record = $this->getRecord();
+               $requestId = 'testrequestid';
+               $this->assertEquals($requestId, $record->setRequestId($requestId)->getRequestId());
+       }
+
+       /**
+        * @test
+        */
+       public function toArrayReturnsCorrectValues() {
+               $component = 'test.core.log';
+               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
+               $message = 'test message';
+               $data = array('foo' => 'bar');
+               /** @var $record \TYPO3\CMS\Core\Log\LogRecord */
+               $record = new \TYPO3\CMS\Core\Log\LogRecord($component, $level, $message, $data);
+               $recordArray = $record->toArray();
+               $this->assertEquals($component, $recordArray['component']);
+               $this->assertEquals($level, $recordArray['level']);
+               $this->assertEquals($message, $recordArray['message']);
+               $this->assertEquals($data, $recordArray['data']);
+       }
+
+       /**
+        * @test
+        */
+       public function toStringIncludesDataAsJson() {
+               $dataArray = array('foo' => 'bar');
+               $record = $this->getRecord(array('data' => $dataArray));
+               $this->assertContains(json_encode($dataArray), (string) $record);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/LoggerTest.php b/typo3/sysext/core/Tests/Unit/Log/LoggerTest.php
new file mode 100644 (file)
index 0000000..5e98502
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Ingo Renner (ingo@typo3.org)
+ * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+require_once 'Fixtures/WriterFixture.php';
+require_once 'Fixtures/WriterFailing.php';
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\Logger.
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @author Steffen Gebert <steffen.gebert@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class LoggerTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        */
+       public function getNameGetsLoggerName() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $this->assertSame('test.core.log', $logger->getName());
+       }
+
+       /**
+        * @test
+        */
+       public function loggerDoesNotLogRecordsLessCriticalThanLogLevel() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::ERROR, $writer);
+                       // warning < error, thus must not be logged
+               $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
+               $this->assertAttributeEmpty('records', $writer);
+       }
+
+       /**
+        * @test
+        */
+       public function loggerReturnsItselfAfterLogging() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $writer);
+               $returnValue = $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $returnValue);
+       }
+
+       /**
+        * @test
+        */
+       public function loggerReturnsItselfAfterLoggingWithoutWriter() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $returnValue = $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $returnValue);
+       }
+
+       /**
+        * @test
+        */
+       public function loggerReturnsItselfAfterLoggingLessCritical() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::EMERGENCY, $writer);
+               $returnValue = $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
+               $this->assertInstanceOf('TYPO3\\CMS\\Core\\Log\\Logger', $returnValue);
+       }
+
+       /**
+        * @test
+        */
+       public function loggerCallsProcessor() {
+               $component = 'test.core.log';
+               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
+               $message = 'test';
+               $logger = new \TYPO3\CMS\Core\Log\Logger($component);
+               /** @var $processor \TYPO3\CMS\Core\Log\Processor\Processor */
+               $processor = $this->getMock('TYPO3\\CMS\\Core\\Log\\Processor\\NullProcessor', array('processLogRecord'));
+               $processor->expects($this->once())->method('processLogRecord')->will($this->returnValue(new \TYPO3\CMS\Core\Log\LogRecord($component, $level, $message)));
+               $logger->addProcessor($level, $processor);
+                       // we need a writer, otherwise we will not process log records
+               $logger->addWriter($level, new \TYPO3\CMS\Core\Log\Writer\NullWriter());
+               $logger->warning($message);
+       }
+
+       /**
+        * @test
+        */
+       public function loggerLogsRecord() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = $this->getMock('TYPO3\\CMS\\Core\\Log\\Writer\\NullWriter', array('writeLog'));
+               $writer->expects($this->once())->method('writeLog');
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $writer);
+               $logger->warning('test');
+       }
+
+       /**
+        * @test
+        */
+       public function loggerLogsRecordsAtLeastAsCriticalAsLogLevel() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
+                       // notice == notice, thus must be logged
+               $logger->log(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, 'test message');
+               $this->assertAttributeNotEmpty('records', $writer);
+       }
+
+       /**
+        * @test
+        */
+       public function loggerLogsRecordsThroughShorthandMethodDataProvider() {
+               return array(
+                       array('emergency'),
+                       array('alert'),
+                       array('critical'),
+                       array('error'),
+                       array('warning'),
+                       array('notice'),
+                       array('info'),
+                       array('debug')
+               );
+       }
+
+       /**
+        * @test
+        * @param string $shorthandMethod
+        * @dataProvider loggerLogsRecordsThroughShorthandMethodDataProvider
+        */
+       public function loggerLogsRecordsThroughShorthandMethod($shorthandMethod) {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $writer);
+               call_user_func(array($logger, $shorthandMethod), 'test message');
+               $this->assertAttributeNotEmpty('records', $writer);
+       }
+
+       /**
+        * @test
+        */
+       public function loggerLogsRecordsMoreCriticalThanLogLevel() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
+                       // warning > notice, thus must be logged
+               $logger->log(\TYPO3\CMS\Core\Log\LogLevel::WARNING, 'test message');
+               $this->assertAttributeNotEmpty('records', $writer);
+       }
+
+       /**
+        * @test
+        */
+       public function addWriterAddsWriterToTheSpecifiedLevel() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
+               $writers = $logger->getWriters();
+               $this->assertContains($writer, $writers[\TYPO3\CMS\Core\Log\LogLevel::NOTICE]);
+       }
+
+       /**
+        * @test
+        */
+       public function addWriterAddsWriterAlsoToHigherLevelsThanSpecified() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Tests\Unit\Log\Fixtures\WriterFixture();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $writer);
+               $writers = $logger->getWriters();
+               $this->assertContains($writer, $writers[\TYPO3\CMS\Core\Log\LogLevel::EMERGENCY]);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/AbstractMemoryTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/AbstractMemoryTest.php
new file mode 100644 (file)
index 0000000..c8e939f
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Steffen Müller (typo3@t3node.com)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor
+ *
+ * @author Steffen Müller <typo3@t3node.com>
+ */
+class AbstractMemoryTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        * @todo Define visibility
+        */
+       public function getRealMemoryUsageGetsRealMemoryUsage() {
+               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
+               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
+               $this->assertAttributeEquals($processor->getRealMemoryUsage(), 'realMemoryUsage', $processor);
+       }
+
+       /**
+        * @test
+        * @todo Define visibility
+        */
+       public function setRealMemoryUsageSetsRealMemoryUsage() {
+               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
+               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
+               $processor->setRealMemoryUsage(FALSE);
+               $this->assertAttributeEquals(FALSE, 'realMemoryUsage', $processor);
+       }
+
+       /**
+        * @test
+        * @todo Define visibility
+        */
+       public function getFormatSizeGetsFormatSize() {
+               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
+               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
+               $this->assertAttributeEquals($processor->getFormatSize(), 'formatSize', $processor);
+       }
+
+       /**
+        * @test
+        * @todo Define visibility
+        */
+       public function setFormatSizeSetsFormatSize() {
+               /** @var $processor \TYPO3\CMS\Core\Log\Processor\AbstractMemoryProcessor */
+               $processor = $this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Log\\Processor\\AbstractMemoryProcessor');
+               $processor->setFormatSize(FALSE);
+               $this->assertAttributeEquals(FALSE, 'formatSize', $processor);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/AbstractTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/AbstractTest.php
new file mode 100644 (file)
index 0000000..4a6aef4
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Steffen Müller (typo3@t3node.com)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+require_once (__DIR__ . DIRECTORY_SEPARATOR) . '../Fixtures/ProcessorFixture.php';
+
+/**
+ * Testcase for t3lib_log_processor_Abstract
+ *
+ * @author Steffen Müller <typo3@t3node.com>
+ */
+class AbstractTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        * @expectedException InvalidArgumentException
+        */
+       public function processorRefusesInvalidConfigurationOptions() {
+               $invalidConfiguration = array(
+                       'foo' => 'bar'
+               );
+               $processor = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Tests\\Unit\\Log\\Fixtures\\ProcessorFixture', $invalidConfiguration);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/IntrospectionTest.php
new file mode 100644 (file)
index 0000000..8d43058
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Steffen Müller (typo3@t3node.com)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for the web introspection processor.
+ *
+ * @author Steffen Müller <typo3@t3node.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class IntrospectionTest extends \tx_phpunit_testcase {
+
+       /**
+        * Tests if debug_backtrace values are added to LogRecord
+        * The debug_backtrace in \TYPO3\CMS\Core\Log\Processor\IntrospectionProcessor will always process a phpunit class.
+        * The result is unpredictable values. So we only test if values are not empty/0
+        *
+        * @test
+        */
+       public function introspectionProcessorAddsIntrospectionDataToLogRecord() {
+               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
+               $processor = new \TYPO3\CMS\Core\Log\Processor\IntrospectionProcessor();
+               $logRecord = $processor->processLogRecord($logRecord);
+               $this->assertNotEmpty($logRecord['data']['file'], 'Asserting that file name in debug_backtrace() is not empty');
+               $this->assertGreaterThan(0, $logRecord['data']['line'], 'Asserting that line numer in debug_backtrace() is greater than 0');
+               $this->assertNotEmpty($logRecord['data']['class'], 'Asserting that class in debug_backtrace() is not empty');
+               $this->assertNotEmpty($logRecord['data']['function'], 'Asserting that function in debug_backtrace() is not empty');
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/MemoryPeakUsageTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/MemoryPeakUsageTest.php
new file mode 100644 (file)
index 0000000..cfe8952
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Steffen Müller (typo3@t3node.com)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for the memoryPeakUsage log processor.
+ *
+ * @author Steffen Müller <typo3@t3node.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class MemoryPeakUsageTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        */
+       public function memoryPeakUsagePRocessorAddsMemoryPeakUsageDataToLogRecord() {
+               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
+               $processor = new \TYPO3\CMS\Core\Log\Processor\MemoryPeakUsageProcessor();
+               $logRecord = $processor->processLogRecord($logRecord);
+               $this->assertArrayHasKey('memoryPeakUsage', $logRecord['data']);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/MemoryUsageTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/MemoryUsageTest.php
new file mode 100644 (file)
index 0000000..20d8e74
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Steffen Müller (typo3@t3node.com)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for the memoryUsage log processor.
+ *
+ * @author Steffen Müller <typo3@t3node.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class MemoryUsageTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        */
+       public function memoryUsagePRocessorAddsMemoryUsageDataToLogRecord() {
+               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
+               $processor = new \TYPO3\CMS\Core\Log\Processor\MemoryUsageProcessor();
+               $logRecord = $processor->processLogRecord($logRecord);
+               $this->assertArrayHasKey('memoryUsage', $logRecord['data']);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/ProcessorTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/ProcessorTest.php
new file mode 100644 (file)
index 0000000..fdc81a7
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Ingo Renner (ingo@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for log processors.
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class ProcessorTest extends \tx_phpunit_testcase implements \TYPO3\CMS\Core\Log\Processor\Processor {
+
+       /**
+        * @var bool
+        */
+       public $processorCalled = FALSE;
+
+       /**
+        * Processes a log record and adds server data.
+        *
+        * @param \TYPO3\CMS\Core\Log\LogRecord $logRecord The log record to process
+        * @return \TYPO3\CMS\Core\Log\LogRecord The processed log record with addtional data
+        */
+       public function processLogRecord(\TYPO3\CMS\Core\Log\LogRecord $logRecord) {
+               $this->processorCalled = TRUE;
+               return $logRecord;
+       }
+
+       /**
+        * @test
+        */
+       public function loggerExecutesProcessors() {
+               $logger = new \TYPO3\CMS\Core\Log\Logger('test.core.log');
+               $writer = new \TYPO3\CMS\Core\Log\Writer\NullWriter();
+               $level = \TYPO3\CMS\Core\Log\LogLevel::DEBUG;
+               $logger->addWriter($level, $writer);
+               $logger->addProcessor($level, $this);
+               $logger->warning('test');
+               $this->assertTrue($this->processorCalled);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Processor/WebTest.php b/typo3/sysext/core/Tests/Unit/Log/Processor/WebTest.php
new file mode 100644 (file)
index 0000000..2c8c5d3
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Processor;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2012 Ingo Renner (ingo@typo3.org)
+ * (c) 2012 Steffen Müller (typo3@t3node.com)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for the web log processor.
+ *
+ * @author Ingo Renner <ingo@typo3.org>
+ * @author Steffen Müller <typo3@t3node.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class WebTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        */
+       public function webProcessorAddsWebDataToLogRecord() {
+               $environmentVariables = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('_ARRAY');
+               $logRecord = new \TYPO3\CMS\Core\Log\LogRecord('test.core.log', \TYPO3\CMS\Core\Log\LogLevel::DEBUG, 'test');
+               $processor = new \TYPO3\CMS\Core\Log\Processor\WebProcessor();
+               $logRecord = $processor->processLogRecord($logRecord);
+               foreach ($environmentVariables as $key => $value) {
+                       $this->assertEquals($value, $logRecord['data'][$key]);
+               }
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Writer/AbstractTest.php b/typo3/sysext/core/Tests/Unit/Log/Writer/AbstractTest.php
new file mode 100644 (file)
index 0000000..00777ff
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Writer;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+require_once (__DIR__ . DIRECTORY_SEPARATOR) . '../Fixtures/WriterFixture.php';
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\Writer\AbstractWriter
+ *
+ * @author Steffen Gebert <steffen.gebert@typo3.org>
+ */
+class AbstractTest extends \tx_phpunit_testcase {
+
+       /**
+        * @test
+        * @expectedException InvalidArgumentException
+        */
+       public function refusesInvalidConfigurationOptions() {
+               $invalidConfiguration = array(
+                       'foo' => 'bar'
+               );
+               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Tests\\Unit\\Log\\Fixtures\\WriterFixture', $invalidConfiguration);
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseTest.php b/typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseTest.php
new file mode 100644 (file)
index 0000000..12be4b1
--- /dev/null
@@ -0,0 +1,141 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Writer;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\Writer\DatabaseWriter
+ *
+ * @author Steffen Gebert <steffen.gebert@typo3.org>
+ */
+class DatabaseTest extends \tx_phpunit_testcase {
+
+       /**
+        * Backup and restore of the $GLOBALS array.
+        *
+        * @var boolean
+        */
+       protected $backupGlobalsArray = array();
+
+       /**
+        * Mock object of t3lib_db
+        *
+        * @var PHPUnit_Framework_MockObject_MockObject
+        */
+       private $databaseStub;
+
+       /**
+        * Create a new database mock object for every test
+        * and backup the original global database object.
+        *
+        * @return void
+        */
+       public function setUp() {
+               $this->backupGlobalsArray['TYPO3_DB'] = $GLOBALS['TYPO3_DB'];
+               $this->databaseStub = $this->setUpAndReturnDatabaseStub();
+       }
+
+       /**
+        * Restore global database object.
+        *
+        * @return void
+        */
+       protected function tearDown() {
+               $GLOBALS['TYPO3_DB'] = $this->backupGlobalsArray['TYPO3_DB'];
+       }
+
+       //////////////////////
+       // Utility functions
+       //////////////////////
+       /**
+        * Set up the stub to be able to get the result of the prepared statement.
+        *
+        * @return PHPUnit_Framework_MockObject_MockObject
+        */
+       private function setUpAndReturnDatabaseStub() {
+               $databaseLink = $GLOBALS['TYPO3_DB']->link;
+               $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array('exec_INSERTquery'), array(), '', FALSE, FALSE);
+               $GLOBALS['TYPO3_DB']->link = $databaseLink;
+               return $GLOBALS['TYPO3_DB'];
+       }
+
+       /**
+        * Creates a test logger
+        *
+        * @return \TYPO3\CMS\Core\Log\Logger
+        */
+       protected function createLogger() {
+               $loggerName = uniqid('test.core.datbaseWriter');
+               /** @var \TYPO3\CMS\Core\Log\Logger $logger */
+               $logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger($loggerName);
+               return $logger;
+       }
+
+       /**
+        * Creates a database writer
+        *
+        * @return \TYPO3\CMS\Core\Log\Writer\DatabaseWriter
+        */
+       protected function createWriter() {
+               /** @var \TYPO3\CMS\Core\Log\Writer\DatabaseWriter $writer */
+               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\DatabaseWriter');
+               return $writer;
+       }
+
+       /**
+        * @test
+        */
+       public function setLogTableSetsLogTable() {
+               $logTable = uniqid('logtable_');
+               $this->assertSame($logTable, $this->createWriter()->setLogTable($logTable)->getLogTable());
+       }
+
+       /**
+        * @return array
+        */
+       public function writerLogsToDatabaseDataProvider() {
+               $simpleRecord = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', 'test.core.databaseWriter.simpleRecord', \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test entry');
+               $recordWithData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', 'test.core.databaseWriter.recordWithData', \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test entry with data', array('foo' => array('bar' => 'baz')));
+               return array(
+                       'simple record' => array($simpleRecord),
+                       'record with data' => array($recordWithData)
+               );
+       }
+
+       /**
+        * @test
+        * @param \TYPO3\CMS\Core\Log\LogRecord $record Record Test Data
+        * @dataProvider writerLogsToDatabaseDataProvider
+        */
+       public function writerLogsToDatabase(\TYPO3\CMS\Core\Log\LogRecord $record) {
+               $logger = $this->createLogger();
+               $databaseWriter = $this->createWriter();
+               $logger->addWriter(\TYPO3\CMS\Core\Log\LogLevel::NOTICE, $databaseWriter);
+               $this->databaseStub->expects($this->once())->method('exec_INSERTquery');
+               $logger->log($record->getLevel(), $record->getMessage());
+       }
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Tests/Unit/Log/Writer/FileTest.php b/typo3/sysext/core/Tests/Unit/Log/Writer/FileTest.php
new file mode 100644 (file)
index 0000000..a03f5c9
--- /dev/null
@@ -0,0 +1,177 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Log\Writer;
+
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2011-2012 Steffen Gebert (steffen.gebert@typo3.org)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Testcase for \TYPO3\CMS\Core\Log\Writer\FileWriter
+ *
+ * @author Steffen Gebert <steffen.gebert@typo3.org>
+ */
+class FileTest extends \tx_phpunit_testcase {
+
+       /**
+        * @var string
+        */
+       protected $logFileDirectory = 'Log';
+
+       /**
+        * @var string
+        */
+       protected $logFileName = 'test.log';
+
+       protected function setUpVfsStream() {
+               if (!class_exists('vfsStream')) {
+                       $this->markTestSkipped('File backend tests are not available with this phpunit version.');
+               }
+               \vfsStream::setup('LogRoot');
+       }
+
+       /**
+        * Creates a test logger
+        *
+        * @param string $name
+        * @internal param string $component Component key
+        * @return \TYPO3\CMS\Core\Log\Logger
+        */
+       protected function createLogger($name = '') {
+               if (empty($name)) {
+                       $name = uniqid('test.core.log.');
+               }
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->registerLogger($name);
+               /** @var \TYPO3\CMS\Core\Log\Logger $logger */
+               $logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger($name);
+               return $logger;
+       }
+
+       /**
+        * Creates a file writer
+        *
+        * @return \TYPO3\CMS\Core\Log\Writer\FileWriter
+        */
+       protected function createWriter() {
+               /** @var \TYPO3\CMS\Core\Log\Writer\FileWriter $writer */
+               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter', array(
+                       'logFile' => (('vfs://LogRoot/' . $this->logFileDirectory) . '/') . $this->logFileName
+               ));
+               return $writer;
+       }
+
+       protected function getDefaultFileName() {
+               return (('vfs://LogRoot/' . $this->logFileDirectory) . '/') . $this->logFileName;
+       }
+
+       /**
+        * @test
+        */
+       public function setLogFileSetsLogFile() {
+               $this->setUpVfsStream();
+               \vfsStream::newFile($this->logFileName)->at(\vfsStreamWrapper::getRoot());
+               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter');
+               $writer->setLogFile($this->getDefaultFileName());
+               $this->assertAttributeEquals($this->getDefaultFileName(), 'logFile', $writer);
+       }
+
+       /**
+        * @test
+        * @expectedException InvalidArgumentException
+        */
+       public function setLogFileRefusesIllegalPath() {
+               $writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter');
+               $writer->setLogFile('/tmp/typo3.log');
+       }
+
+       /**
+        * @test
+        */
+       public function createsLogFileDirectory() {
+               $this->setUpVfsStream();
+               $this->createWriter();
+               $this->assertTrue(\vfsStreamWrapper::getRoot()->hasChild($this->logFileDirectory));
+       }
+
+       /**
+        * @test
+        */
+       public function createsLogFile() {
+               $this->setUpVfsStream();
+               $this->createWriter();
+               $this->assertTrue(\vfsStreamWrapper::getRoot()->getChild($this->logFileDirectory)->hasChild($this->logFileName));
+       }
+
+       /**
+        * @return array
+        */
+       public function logsToFileDataProvider() {
+               $simpleRecord = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', uniqid('test.core.log.fileWriter.simpleRecord.'), \TYPO3\CMS\Core\Log\LogLevel::INFO, 'test record');
+               $recordWithData = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\LogRecord', uniqid('test.core.log.fileWriter.recordWithData.'), \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test record with data', array('foo' => array('bar' => 'baz')));
+               return array(
+                       'simple record' => array($simpleRecord, (string) $simpleRecord),
+                       'record with data' => array($recordWithData, (string) $recordWithData)
+               );
+       }
+
+       /**
+        * @test
+        * @param \TYPO3\CMS\Core\Log\LogRecord $record Record Test Data
+        * @param string $expectedResult Needle
+        * @dataProvider logsToFileDataProvider
+        */
+       public function logsToFile(\TYPO3\CMS\Core\Log\LogRecord $record, $expectedResult) {
+               $this->setUpVfsStream();
+               $this->createWriter()->writeLog($record);
+               $logFileContents = file_get_contents($this->getDefaultFileName());
+               $logFileContents = trim($logFileContents);
+               $expectedResult = trim($expectedResult);
+               $this->assertEquals($logFileContents, $expectedResult);
+       }
+
+       /**
+        * @test
+        */
+       public function createsHtaccessForNewDirectory() {
+               $this->setUpVfsStream();
+               $directory = uniqid('Log');
+               $logFile = (('vfs://LogRoot/' . $directory) . '/') . $this->logFileName;
+               $this->createWriter()->setLogFile($logFile);
+               $this->assertFileExists(('vfs://LogRoot/' . $directory) . '/.htaccess');
+       }
+
+       /**
+        * @test
+        */
+       public function createsNoHtaccessForExistingDirectory() {
+               $this->setUpVfsStream();
+               $directory = uniqid('Log');
+                       // create a directory
+               \vfsStreamWrapper::getRoot()->addChild(new \vfsStreamDirectory($directory));
+               $logFile = (('vfs://LogRoot/' . $directory) . '/') . $this->logFileName;
+               $this->assertTrue(is_dir('vfs://LogRoot/' . $directory));
+               $this->createWriter()->setLogFile($logFile);
+               $this->assertFileNotExists(('vfs://LogRoot/' . $directory) . '/.htaccess');
+       }
+
+}
+
+?>
\ No newline at end of file