[BUGFIX] Follow-Up: Missing signals on adding file 53/23753/2
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Wed, 11 Sep 2013 15:04:37 +0000 (17:04 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 11 Sep 2013 15:26:58 +0000 (17:26 +0200)
Mocked driver needs to return a proper "file" on calls to addFile().

Change-Id: Iddfc2f9b7e71101ad229a513727f65f64d654d45
Releases: 6.2, 6.1, 6.0
Resolves: #50795
Reviewed-on: https://review.typo3.org/23753
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php

index f37fe77..3ef12cd 100644 (file)
@@ -241,9 +241,11 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
                $this->initializeVfs();
                $localFilePath = $this->getUrlInMount('file.ext');
                $this->prepareFixture(array(), TRUE);
+               /** @var $file \TYPO3\CMS\Core\Resource\FileInterface */
+               $file = $this->getMock('TYPO3\\CMS\\Core\\Resource\\FileInterface', array(), array(), '', FALSE);
                /** @var $driver \TYPO3\CMS\Core\Resource\Driver\LocalDriver */
                $driver = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array('addFile'), array(array('basePath' => $this->getUrlInMount('targetFolder/'))));
-               $driver->expects($this->once())->method('addFile')->with($this->equalTo($localFilePath), $this->anything(), $this->equalTo('file.ext'));
+               $driver->expects($this->once())->method('addFile')->with($this->equalTo($localFilePath), $this->anything(), $this->equalTo('file.ext'))->will($this->returnValue($file));
                $this->fixture->setDriver($driver);
                $this->fixture->addFile($localFilePath, $mockedFolder);
        }
@@ -262,9 +264,11 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
                ));
                $this->initializeVfs();
                $this->prepareFixture(array(), TRUE);
+               /** @var $file \TYPO3\CMS\Core\Resource\FileInterface */
+               $file = $this->getMock('TYPO3\\CMS\\Core\\Resource\\FileInterface', array(), array(), '', FALSE);
                /** @var $driver \TYPO3\CMS\Core\Resource\Driver\LocalDriver */
                $driver = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array('addFile', 'fileExistsInFolder'), array(array('basePath' => $this->getUrlInMount('targetFolder/'))));
-               $driver->expects($this->once())->method('addFile')->with($this->anything(), $this->anything(), $this->equalTo('file_02.ext'));
+               $driver->expects($this->once())->method('addFile')->with($this->anything(), $this->anything(), $this->equalTo('file_02.ext'))->will($this->returnValue($file));
                $driver->expects($this->exactly(3))->method('fileExistsInFolder')->will($this->onConsecutiveCalls($this->returnValue(TRUE), $this->returnValue(TRUE), $this->returnValue(FALSE)));
                $this->fixture->setDriver($driver);
                $this->fixture->addFile($this->getUrlInMount('file.ext'), $mockedFolder);