From a1ef28a83baea3e890f89e39be53d4e48b20eb08 Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Sat, 25 Mar 2017 10:52:57 +0100 Subject: [PATCH] [BUGFIX] Use correct property for images in FrontendUser 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> --- .../extbase/Classes/Domain/Model/FrontendUser.php | 13 ++++++------- .../Tests/Unit/Domain/Model/FrontendUserTest.php | 14 ++++++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php b/typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php index 3845d5d737bb..195b4c005e62 100644 --- a/typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php +++ b/typo3/sysext/extbase/Classes/Domain/Model/FrontendUser.php @@ -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() { diff --git a/typo3/sysext/extbase/Tests/Unit/Domain/Model/FrontendUserTest.php b/typo3/sysext/extbase/Tests/Unit/Domain/Model/FrontendUserTest.php index 8081bda1fb95..26f96a417718 100644 --- a/typo3/sysext/extbase/Tests/Unit/Domain/Model/FrontendUserTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Domain/Model/FrontendUserTest.php @@ -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()); } /** -- GitLab