[BUGFIX] Use correct property for images in FrontendUser 46/52146/2
authorGeorg Ringer <georg.ringer@gmail.com>
Sat, 25 Mar 2017 09:52:57 +0000 (10:52 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 28 Mar 2017 08:37:38 +0000 (10:37 +0200)
As the image field has been changed to FAL, also the model must
be adopted.

Resolves: #80437
Releases: master
Change-Id: I09b6ef8db190467ee5dfea67e5e66ded12b99dcd
Reviewed-on: https://review.typo3.org/52146
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Nikolai Townsend <info@nikolaitownsend.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php
typo3/sysext/extbase/Tests/Unit/Domain/Model/FrontendUserTest.php

index 3845d5d..195b4c0 100644 (file)
@@ -112,9 +112,9 @@ class FrontendUser extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
     protected $company = '';
 
     /**
-     * @var string
+     * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
      */
-    protected $image = '';
+    protected $image = null;
 
     /**
      * @var \DateTime|NULL
@@ -578,20 +578,19 @@ class FrontendUser extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
     /**
      * Sets the image value
      *
-     * @param string $image
-     * @return void
      * @api
+     * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $image
      */
-    public function setImage($image)
+    public function setImage(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $image)
     {
         $this->image = $image;
     }
 
     /**
-     * Returns the image value
+     * Gets the image value
      *
-     * @return string
      * @api
+     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
      */
     public function getImage()
     {
index 8081bda..26f96a4 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Domain\Model;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Domain\Model\FileReference;
+use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
 
 /**
  * Test case
@@ -374,7 +376,7 @@ class FrontendUserTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function getImageInitiallyReturnsEmptyString()
     {
-        $this->assertSame('', $this->subject->getImage());
+        $this->assertSame(null, $this->subject->getImage());
     }
 
     /**
@@ -382,9 +384,13 @@ class FrontendUserTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
      */
     public function setImageSetsImage()
     {
-        $image = 'foobar.gif';
-        $this->subject->setImage($image);
-        $this->assertSame($image, $this->subject->getImage());
+        $images = new ObjectStorage();
+        $reference = new FileReference();
+        $reference->setPid(123);
+        $images->attach($reference);
+
+        $this->subject->setImage($images);
+        $this->assertSame($images, $this->subject->getImage());
     }
 
     /**