ElasticsearchAdminResetCommand example

protected function setUp(): void
    {
        $this->connection = $this->createMock(Connection::class);
        $this->client = $this->createMock(Client::class);
    }

    public function testExecuteWithEsNotEnabled(): void
    {
        $searchHelper = $this->getMockBuilder(AdminElasticsearchHelper::class)->disableOriginalConstructor()->getMock();
        $searchHelper->expects(static::any())->method('getEnabled')->willReturn(false);
        $commandTester = new CommandTester(
            new ElasticsearchAdminResetCommand(
                $this->client,
                $this->connection,
                $this->createMock(IncrementGatewayRegistry::class),
                $searchHelper
            )
        );
        $commandTester->execute([]);

        $message = $commandTester->getDisplay();

        static::assertStringContainsString('Admin elasticsearch is not enabled', $message);
    }
Home | Imprint | This part of the site doesn't use cookies.