Skip to content
Snippets Groups Projects
Commit 2b1a6eb6 authored by Torben Hansen's avatar Torben Hansen Committed by Christian Kuhn
Browse files

[TASK] Replace prophecy in EXT:core TreeDataProviderFactoryTest

Resolves: #98806
Releases: main
Change-Id: I9e87fd549f0fbc29fc392cc73944d92fbc83ddb8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76580


Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 7fc708f5
Branches
Tags
No related merge requests found
...@@ -17,8 +17,8 @@ declare(strict_types=1); ...@@ -17,8 +17,8 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration; namespace TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\EventDispatcher\EventDispatcherInterface; use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Core\EventDispatcher\NoopEventDispatcher;
use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderFixture; use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderFixture;
use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderWithConfigurationFixture; use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderWithConfigurationFixture;
use TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider; use TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeDataProvider;
...@@ -28,8 +28,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; ...@@ -28,8 +28,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
class TreeDataProviderFactoryTest extends UnitTestCase class TreeDataProviderFactoryTest extends UnitTestCase
{ {
use ProphecyTrait;
protected function setUp(): void protected function setUp(): void
{ {
parent::setUp(); parent::setUp();
...@@ -96,8 +94,8 @@ class TreeDataProviderFactoryTest extends UnitTestCase ...@@ -96,8 +94,8 @@ class TreeDataProviderFactoryTest extends UnitTestCase
public function factoryThrowsExceptionIfInvalidConfigurationIsGiven(array $tcaConfiguration, int $expectedExceptionCode): void public function factoryThrowsExceptionIfInvalidConfigurationIsGiven(array $tcaConfiguration, int $expectedExceptionCode): void
{ {
if (isset($tcaConfiguration['type']) && $tcaConfiguration['type'] !== 'folder' && is_array($tcaConfiguration['treeConfig'] ?? null)) { if (isset($tcaConfiguration['type']) && $tcaConfiguration['type'] !== 'folder' && is_array($tcaConfiguration['treeConfig'] ?? null)) {
$treeDataProvider = $this->prophesize(DatabaseTreeDataProvider::class); $treeDataProvider = $this->createMock(DatabaseTreeDataProvider::class);
GeneralUtility::addInstance(DatabaseTreeDataProvider::class, $treeDataProvider->reveal()); GeneralUtility::addInstance(DatabaseTreeDataProvider::class, $treeDataProvider);
} }
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
...@@ -112,8 +110,7 @@ class TreeDataProviderFactoryTest extends UnitTestCase ...@@ -112,8 +110,7 @@ class TreeDataProviderFactoryTest extends UnitTestCase
public function configuredDataProviderClassIsInstantiated(): void public function configuredDataProviderClassIsInstantiated(): void
{ {
$dataProviderMockClassName = TreeDataProviderFixture::class; $dataProviderMockClassName = TreeDataProviderFixture::class;
$eventDispatcher = $this->prophesize(EventDispatcherInterface::class); GeneralUtility::addInstance(EventDispatcherInterface::class, new NoopEventDispatcher());
GeneralUtility::addInstance(EventDispatcherInterface::class, $eventDispatcher->reveal());
$tcaConfiguration = [ $tcaConfiguration = [
'treeConfig' => ['dataProvider' => $dataProviderMockClassName], 'treeConfig' => ['dataProvider' => $dataProviderMockClassName],
...@@ -130,8 +127,7 @@ class TreeDataProviderFactoryTest extends UnitTestCase ...@@ -130,8 +127,7 @@ class TreeDataProviderFactoryTest extends UnitTestCase
public function configuredDataProviderClassIsInstantiatedWithTcaConfigurationInConstructor(): void public function configuredDataProviderClassIsInstantiatedWithTcaConfigurationInConstructor(): void
{ {
$dataProviderMockClassName = TreeDataProviderWithConfigurationFixture::class; $dataProviderMockClassName = TreeDataProviderWithConfigurationFixture::class;
$eventDispatcher = $this->prophesize(EventDispatcherInterface::class); GeneralUtility::addInstance(EventDispatcherInterface::class, new NoopEventDispatcher());
GeneralUtility::addInstance(EventDispatcherInterface::class, $eventDispatcher->reveal());
$tcaConfiguration = [ $tcaConfiguration = [
'treeConfig' => [ 'treeConfig' => [
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment