Skip to content
Snippets Groups Projects
Commit 248832dd authored by Nikita Hovratov's avatar Nikita Hovratov Committed by Stefan Bürk
Browse files

[TASK] Replace prophecy in EXT:core ExtensionConfigurationTest

Resolves: #98751
Releases: main
Change-Id: I5e127bebb5fdab914c535c7f16f1ff85ce1d9778
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76572


Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
parent fedbd3ee
Branches
Tags
No related merge requests found
...@@ -17,8 +17,6 @@ declare(strict_types=1); ...@@ -17,8 +17,6 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Tests\Unit\Configuration; namespace TYPO3\CMS\Core\Tests\Unit\Configuration;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Configuration\ConfigurationManager; use TYPO3\CMS\Core\Configuration\ConfigurationManager;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
...@@ -26,8 +24,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase; ...@@ -26,8 +24,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
class ExtensionConfigurationTest extends UnitTestCase class ExtensionConfigurationTest extends UnitTestCase
{ {
use ProphecyTrait;
/** /**
* @test * @test
*/ */
...@@ -86,10 +82,14 @@ class ExtensionConfigurationTest extends UnitTestCase ...@@ -86,10 +82,14 @@ class ExtensionConfigurationTest extends UnitTestCase
*/ */
public function setRemovesFullExtensionConfiguration(): void public function setRemovesFullExtensionConfiguration(): void
{ {
$configurationManagerProphecy = $this->prophesize(ConfigurationManager::class); $configurationManagerMock = $this->createMock(ConfigurationManager::class);
GeneralUtility::addInstance(ConfigurationManager::class, $configurationManagerProphecy->reveal()); GeneralUtility::addInstance(ConfigurationManager::class, $configurationManagerMock);
$configurationManagerProphecy->removeLocalConfigurationKeysByPath(['EXTENSIONS/foo'])->shouldBeCalled(); $configurationManagerMock->expects(self::once())->method('removeLocalConfigurationKeysByPath')->with(['EXTENSIONS/foo']);
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['foo'] = [
'bar' => 'baz',
];
(new ExtensionConfiguration())->set('foo'); (new ExtensionConfiguration())->set('foo');
self::assertFalse(isset($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['foo']));
} }
/** /**
...@@ -97,10 +97,15 @@ class ExtensionConfigurationTest extends UnitTestCase ...@@ -97,10 +97,15 @@ class ExtensionConfigurationTest extends UnitTestCase
*/ */
public function setWritesFullExtensionConfig(): void public function setWritesFullExtensionConfig(): void
{ {
$configurationManagerProphecy = $this->prophesize(ConfigurationManager::class); $value = ['bar' => 'baz'];
GeneralUtility::addInstance(ConfigurationManager::class, $configurationManagerProphecy->reveal()); $configurationManagerMock = $this->createMock(ConfigurationManager::class);
$configurationManagerProphecy->setLocalConfigurationValueByPath(Argument::cetera())->shouldBeCalled(); GeneralUtility::addInstance(ConfigurationManager::class, $configurationManagerMock);
$configurationManagerProphecy->setLocalConfigurationValueByPath('EXTENSIONS/foo', ['bar' => 'baz'])->shouldBeCalled(); $configurationManagerMock->expects(self::once())->method('setLocalConfigurationValueByPath')->with('EXTENSIONS/foo', $value);
(new ExtensionConfiguration())->set('foo', ['bar' => 'baz']); $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['foo'] = [
'bar' => 'fizz',
'bee' => 'boo',
];
(new ExtensionConfiguration())->set('foo', $value);
self::assertSame($value, $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['foo']);
} }
} }
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