[BUGFIX] t3lib_file_Utility_FileExtensionFilterTest fails
authorOliver Hader <oliver@typo3.org>
Sat, 16 Jun 2012 14:57:30 +0000 (16:57 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 16 Jun 2012 17:42:12 +0000 (19:42 +0200)
t3lib_file_Utility_FileExtensionFilterTest fails due to not
mocked factory object.

Change-Id: Ibd5246f85e56a241c5e463ca62d7ab9beef0a664
Fixes: #38115
Releases: 6.0
Reviewed-on: http://review.typo3.org/12130
Reviewed-by: Oliver Klee
Tested-by: Oliver Klee
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
tests/Unit/t3lib/file/Utility/FileExtensionFilterTest.php

index 90ce50f..20ab3b3 100644 (file)
@@ -48,21 +48,32 @@ class t3lib_file_Utility_FileExtensionFilterTest extends Tx_Phpunit_TestCase {
         */
        protected $tceMainMock;
 
+       /**
+        * @var t3lib_file_Factory|PHPUnit_Framework_MockObject_MockObject
+        */
+       protected $fileFactoryMock;
+
        /**
         * Sets up this test suite.
         */
        protected function setUp() {
                $this->filter = new t3lib_file_Utility_FileExtensionFilter();
                $this->tceMainMock = $this->getMock('t3lib_TCEmain', array('deleteAction'), array());
+               $this->fileFactoryMock = $this->getMock('t3lib_file_Factory', array('getFileReferenceObject'), array());
+
+               t3lib_div::setSingletonInstance('t3lib_file_Factory', $this->fileFactoryMock);
        }
 
        /**
         * Cleans up this test suite.
         */
        protected function tearDown() {
+               unset($this->fileFactoryMock);
                unset($this->tceMainMock);
                unset($this->parameters);
                unset($this->filter);
+
+               t3lib_div::purgeInstances();
        }
 
        /**
@@ -81,6 +92,7 @@ class t3lib_file_Utility_FileExtensionFilterTest extends Tx_Phpunit_TestCase {
                );
 
                $this->tceMainMock->expects($this->never())->method('deleteAction');
+               $this->fileFactoryMock->expects(($this->never()))->method(('getFileReferenceObject'));
                $this->filter->filterInlineChildren($this->parameters, $this->tceMainMock);
        }
 
@@ -89,9 +101,9 @@ class t3lib_file_Utility_FileExtensionFilterTest extends Tx_Phpunit_TestCase {
         */
        public function invalidInlineChildrenFilterParametersDataProvider() {
                return array(
-                       array('', '', array(0, 1, 3, 4)),
                        array(NULL, NULL, NULL),
-                       array(NULL, NULL, array('', NULL, FALSE)),
+                       array('', '', array(0, '', NULL, FALSE)),
+                       array(NULL, NULL, array(0, '', NULL, FALSE)),
                );
        }
 }