Skip to content
Snippets Groups Projects
Commit 0c63ddd6 authored by Torben Hansen's avatar Torben Hansen Committed by Nikita Hovratov
Browse files

[TASK] Remove prophecy in EXT:core CommandRegistryTest

Resolves: #98772
Releases: main
Change-Id: I53eba1c67f131391d512517820d59696f4de61f6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76797


Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarNikita Hovratov <nikita.h@live.de>
Tested-by: default avatarNikita Hovratov <nikita.h@live.de>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
parent 21591924
Branches
Tags
No related merge requests found
......@@ -17,32 +17,22 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Tests\Unit\Console;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
use TYPO3\CMS\Core\Console\CommandRegistry;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* Testcase for CommandRegistry
*/
class CommandRegistryTest extends UnitTestCase
{
use ProphecyTrait;
/** @var ObjectProphecy<ContainerInterface> */
protected ObjectProphecy $containerProphecy;
protected ContainerInterface&MockObject $containerMock;
/**
* Set up this testcase
*/
protected function setUp(): void
{
parent::setUp();
$this->containerProphecy = $this->prophesize(ContainerInterface::class);
$this->containerMock = $this->createMock(ContainerInterface::class);
}
/**
......@@ -50,7 +40,7 @@ class CommandRegistryTest extends UnitTestCase
*/
public function implementsCommandLoaderInterface(): void
{
$commandRegistry = new CommandRegistry($this->containerProphecy->reveal());
$commandRegistry = new CommandRegistry($this->containerMock);
self::assertInstanceof(CommandLoaderInterface::class, $commandRegistry);
}
......@@ -62,10 +52,12 @@ class CommandRegistryTest extends UnitTestCase
$command1MockClass = $this->getMockClass(Command::class, ['dummy']);
$command2MockClass = $this->getMockClass(Command::class, ['dummy']);
$this->containerProphecy->get('command1')->willReturn(new $command1MockClass());
$this->containerProphecy->get('command2')->willReturn(new $command2MockClass());
$this->containerMock->method('get')->willReturnMap([
['command1', new $command1MockClass()],
['command2', new $command2MockClass()],
]);
$commandRegistry = new CommandRegistry($this->containerProphecy->reveal());
$commandRegistry = new CommandRegistry($this->containerMock);
$commandRegistry->addLazyCommand('test:command', 'command1');
$commandRegistry->addLazyCommand('test:command2', 'command2');
......
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