[BUGFIX] Incomplete mock in ext:frontend FAL getData test 19/24819/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 15 Oct 2013 19:25:18 +0000 (21:25 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 15 Oct 2013 20:34:54 +0000 (22:34 +0200)
The patch for #52818 triggered a failing test for ext:frontend
getData(). The patch mocks a File Resource properly to not test
FAL internals, but only the getData() logic.

Change-Id: I7312f4b9991931008fa68b66dcc9913162c222be
Resolves: #52865
Related: #52818
Releases: 6.2
Reviewed-on: https://review.typo3.org/24819
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Steffen Ritter
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php

index 1e24f0f..5ccb23b 100644 (file)
@@ -1541,22 +1541,15 @@ class ContentObjectRendererTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        }
 
        /**
-        * Checks if getData() works with type "file"
+        * Basic check if getData gets the uid of a file object
         *
         * @test
         */
-       public function getDataWithTypeFile() {
-               $uid = rand();
-               $properties = array(
-                       uniqid() => uniqid(),
-                       uniqid() => uniqid(),
-                       'uid' => $uid
-               );
-               $file = new \TYPO3\CMS\Core\Resource\File($properties,
-                       $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE)
-               );
+       public function getDataWithTypeFileReturnsUidOfFileObject() {
+               $uid = uniqid();
+               $file = $this->getMock('TYPO3\\CMS\\Core\\Resource\File', array(), array(), '', FALSE);
+               $file->expects($this->once())->method('getUid')->will($this->returnValue($uid));
                $this->cObj->setCurrentFile($file);
-
                $this->assertEquals($uid, $this->cObj->getData('file:current:uid'));
        }