Update Version constraints

Also update code base to stay compatible.
This commit is contained in:
Daniel Siepmann 2020-08-25 12:06:12 +02:00
parent 147859eed2
commit d933b207fa
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
3 changed files with 23 additions and 8 deletions

View file

@ -1,4 +1,5 @@
<?php <?php
namespace Codappix\TestingTalk\Tests\Unit\Controller; namespace Codappix\TestingTalk\Tests\Unit\Controller;
/* /*
@ -22,6 +23,7 @@ namespace Codappix\TestingTalk\Tests\Unit\Controller;
use Codappix\TestingTalk\Controller\FrontendUserController; use Codappix\TestingTalk\Controller\FrontendUserController;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy; use Prophecy\Prophecy\ObjectProphecy;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser; use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository; use TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository;
@ -30,6 +32,8 @@ use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
class FrontendUserControllerTest extends TestCase class FrontendUserControllerTest extends TestCase
{ {
use ProphecyTrait;
/** /**
* @var FrontendUserController * @var FrontendUserController
*/ */
@ -44,7 +48,7 @@ class FrontendUserControllerTest extends TestCase
{ {
$this->subject = new FrontendUserController(); $this->subject = new FrontendUserController();
$this->view = $this->prophesize(ViewInterface::class); $this->view = $this->prophesize(ViewInterface::class);
ObjectAccess::setProperty($this->subject, 'view', $this->view->reveal(), true); $this->setProperty($this->subject, 'view', $this->view->reveal());
} }
/** /**
@ -67,7 +71,7 @@ class FrontendUserControllerTest extends TestCase
public function fetchedFrontendUsersAreAssignedToViewInIndexAction() public function fetchedFrontendUsersAreAssignedToViewInIndexAction()
{ {
$frontendUserRepository = $this->prophesize(FrontendUserRepository::class); $frontendUserRepository = $this->prophesize(FrontendUserRepository::class);
ObjectAccess::setProperty($this->subject, 'frontendUserRepository', $frontendUserRepository->reveal(), true); $this->setProperty($this->subject, 'frontendUserRepository', $frontendUserRepository->reveal());
$frontendUserRepository $frontendUserRepository
->findAll() ->findAll()
->willReturn(['user1' => 'test']) ->willReturn(['user1' => 'test'])
@ -79,4 +83,13 @@ class FrontendUserControllerTest extends TestCase
$this->subject->indexAction(); $this->subject->indexAction();
} }
private function setProperty($object, string $propertyName, $value): void
{
$reflectionClass = new \ReflectionClass(get_class($object));
$reflectionProperty = $reflectionClass->getProperty($propertyName);
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($object, $value);
}
} }

View file

@ -1,4 +1,5 @@
<?php <?php
namespace Codappix\TestingTalk\Tests\Unit\Domain\Model; namespace Codappix\TestingTalk\Tests\Unit\Domain\Model;
/* /*

View file

@ -1,5 +1,5 @@
{ {
"name": "codappix/testing_talk", "name": "codappix/testing-talk",
"description": "Example Extension to show testing", "description": "Example Extension to show testing",
"type": "typo3-cms-extension", "type": "typo3-cms-extension",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
@ -15,15 +15,16 @@
} }
}, },
"require": { "require": {
"typo3/cms-core": "^9.5", "typo3/cms-core": "^10.4",
"typo3/cms-extbase": "^9.5" "typo3/cms-extbase": "^10.4"
},
"require-dev": {
"phpunit/phpunit": "^8.0"
}, },
"extra": { "extra": {
"typo3/cms": { "typo3/cms": {
"web-dir": "web" "web-dir": "web"
} }
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"phpspec/prophecy-phpunit": "^2.0"
} }
} }