From 2b66a8b6f284fc347517f5c2982d6602bc6cf561 Mon Sep 17 00:00:00 2001 From: Anna Larch Date: Mon, 10 Jun 2024 15:06:21 +0200 Subject: [PATCH] fix: failing tests for setup check Signed-off-by: Anna Larch --- .../tests/Controller/CheckSetupControllerTest.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 67fd97aaeaaec..7459c4fb7fdf7 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -47,7 +47,10 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\RedirectResponse; +use OCP\DB\IResult; +use OCP\DB\QueryBuilder\IFunctionBuilder; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\DB\QueryBuilder\IQueryFunction; use OCP\EventDispatcher\IEventDispatcher; use OCP\Http\Client\IClientService; use OCP\IConfig; @@ -612,8 +615,13 @@ public function testCheck() { $this->connection->method('getDatabasePlatform') ->willReturn($sqlitePlatform); $queryBuilder = $this->getMockBuilder(IQueryBuilder::class)->getMock(); - $this->connection->method('getQueryBuilder') - ->willReturn($queryBuilder); + $functionBuilder = $this->getMockBuilder(IFunctionBuilder::class)->getMock(); + $this->connection->method('getQueryBuilder')->willReturn($queryBuilder); + $queryBuilder->method('func')->willReturn($functionBuilder); + $queryBuilder->method('select')->willReturn($queryBuilder); + $queryBuilder->method('from')->willReturn($queryBuilder); + $queryBuilder->method('executeQuery')->willReturn($this->getMockBuilder(IResult::class)->getMock()); + $functionBuilder->method('count')->willReturn($this->getMockBuilder(IQueryFunction::class)->getMock()); $expected = new DataResponse( [