Skip to content

Commit

Permalink
[TASK] Remove prophecy in EXT:core SiteTest
Browse files Browse the repository at this point in the history
Besides the prophecy removal, also 3 assertions
are changed to assert concrete class instances
instead of generic interface. Thus avoid having
superflous tests and transform them into a good
test assertion.

Resolves: #98785
Releases: main
Change-Id: I7d0db4907106f7ef09bf8a5590afce4f57add644
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76713
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Nikita Hovratov <nikita.h@live.de>
Reviewed-by: Nikita Hovratov <nikita.h@live.de>
  • Loading branch information
derhansen authored and nhovratov committed Nov 19, 2022
1 parent 85cdc35 commit 8d483c5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions typo3/sysext/core/Tests/Unit/Site/Entity/SiteTest.php
Expand Up @@ -17,7 +17,6 @@

namespace TYPO3\CMS\Core\Tests\Unit\Site\Entity;

use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ResponseFactoryInterface;
use Symfony\Component\DependencyInjection\Container;
use TYPO3\CMS\Core\Cache\CacheManager;
Expand All @@ -42,8 +41,6 @@

class SiteTest extends UnitTestCase
{
use ProphecyTrait;

public function tearDown(): void
{
parent::tearDown();
Expand Down Expand Up @@ -170,8 +167,7 @@ public function getErrorHandlerReturnsConfiguredErrorHandler(): void
],
]);

$fluidProphecy = $this->prophesize(FluidPageErrorHandler::class);
GeneralUtility::addInstance(FluidPageErrorHandler::class, $fluidProphecy->reveal());
GeneralUtility::addInstance(FluidPageErrorHandler::class, $this->createMock(FluidPageErrorHandler::class));

$app = new class () extends Application {
// This is ugly but php-cs-fixer insists.
Expand Down Expand Up @@ -212,9 +208,9 @@ public function __construct()
$container->set(CacheManager::class, $cacheManager);
GeneralUtility::setContainer($container);

self::assertInstanceOf(PageErrorHandlerInterface::class, $subject->getErrorHandler(123));
self::assertInstanceOf(PageErrorHandlerInterface::class, $subject->getErrorHandler(124));
self::assertInstanceOf(PageErrorHandlerInterface::class, $subject->getErrorHandler(125));
self::assertInstanceOf(FluidPageErrorHandler::class, $subject->getErrorHandler(123));
self::assertInstanceOf(PageContentErrorHandler::class, $subject->getErrorHandler(124));
self::assertInstanceOf(PageContentErrorHandler::class, $subject->getErrorHandler(125));
}

/**
Expand Down

0 comments on commit 8d483c5

Please sign in to comment.