From bcbc72687e00394cd748c989cace328ff1bc96be Mon Sep 17 00:00:00 2001
From: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Date: Tue, 10 Sep 2013 00:11:50 +0200
Subject: [PATCH] [BUGFIX] Follow-up: Fix fileinfo property mapping in
 ResourceStorage

Adjust unittest to changed conditions.

Change-Id: Ia885ba544a159cb1666464cece30c3e6ea3558b6
Fixes: #49386
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/23716
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
---
 .../Unit/Resource/ResourceStorageTest.php     | 25 +++++++++++++++----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php b/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
index 83a559226ef0..f37fe77e1438 100644
--- a/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
+++ b/typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
@@ -407,18 +407,33 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
 	public function setFileContentsUpdatesObjectProperties() {
 		$this->initializeVfs();
 		$this->prepareFixture(array(), TRUE);
-		$fileProperties = array(
-			'someProperty' => 'value',
-			'someOtherProperty' => 42
+		$fileInfo = array(
+			'storage' => 'A',
+			'identifier' => 'B',
+			'mtime' => 'C',
+			'ctime' => 'D',
+			'mimetype' => 'E',
+			'size' => 'F',
+			'name' => 'G',
+		);
+		$newProperties = array(
+			'storage' => $fileInfo['storage'],
+			'identifier' => $fileInfo['identifier'],
+			'tstamp' => $fileInfo['mtime'],
+			'crdate' => $fileInfo['ctime'],
+			'mime_type' => $fileInfo['mimetype'],
+			'size' => $fileInfo['size'],
+			'name' => $fileInfo['name']
 		);
 		$hash = 'asdfg';
 		$driver = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Driver\\LocalDriver', array(), array(array('basePath' => $this->getMountRootUrl())));
-		$driver->expects($this->once())->method('getFileInfo')->will($this->returnValue($fileProperties));
+		$driver->expects($this->once())->method('getFileInfoByIdentifier')->will($this->returnValue($fileInfo));
 		$driver->expects($this->once())->method('hash')->will($this->returnValue($hash));
 		$this->fixture->setDriver($driver);
 		$mockedFile = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', array(), array(), '', FALSE);
 		$mockedFile->expects($this->any())->method('getIdentifier')->will($this->returnValue('/file.ext'));
-		$mockedFile->expects($this->once())->method('updateProperties')->with($this->equalTo(array_merge($fileProperties, array('sha1' => $hash))));
+		$mockedFile->expects($this->at(1))->method('updateProperties')->with($this->equalTo(array('sha1' => $hash)));
+		$mockedFile->expects($this->at(3))->method('updateProperties')->with($this->equalTo($newProperties));
 		$this->fixture->setFileContents($mockedFile, uniqid());
 	}
 
-- 
GitLab