From a429f02a6249287f1819d5455afdef635ad92a7a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 31 Jan 2022 20:36:06 +0100 Subject: Fix unit tests Signed-off-by: Joas Schilling --- tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php | 5 ++++- tests/lib/Authentication/Token/DefaultTokenMapperTest.php | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php b/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php index 0991c8b1fc8..a464dc4b5bb 100644 --- a/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php @@ -25,6 +25,7 @@ namespace Test\Authentication\Token; use OC\Authentication\Token\DefaultTokenCleanupJob; use OC\Authentication\Token\IProvider; use OC\Authentication\Token\Manager; +use OCP\IConfig; use Test\TestCase; class DefaultTokenCleanupJobTest extends TestCase { @@ -36,11 +37,13 @@ class DefaultTokenCleanupJobTest extends TestCase { protected function setUp(): void { parent::setUp(); + $this->config = $this->createMock(IConfig::class); + $this->tokenProvider = $this->getMockBuilder(Manager::class) ->disableOriginalConstructor() ->getMock(); $this->overwriteService(IProvider::class, $this->tokenProvider); - $this->job = new DefaultTokenCleanupJob(); + $this->job = new DefaultTokenCleanupJob($this->config); } public function testRun() { diff --git a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php index da779be0807..9b9bfaf4821 100644 --- a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php @@ -27,8 +27,10 @@ use OC\Authentication\Token\DefaultToken; use OC\Authentication\Token\DefaultTokenMapper; use OC\Authentication\Token\IToken; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\IConfig; use OCP\IDBConnection; use OCP\IUser; +use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; /** @@ -44,6 +46,8 @@ class DefaultTokenMapperTest extends TestCase { /** @var IDBConnection */ private $dbConnection; + /** @var IConfig|MockObject */ + private $config; private $time; protected function setUp(): void { @@ -51,9 +55,10 @@ class DefaultTokenMapperTest extends TestCase { $this->dbConnection = OC::$server->getDatabaseConnection(); $this->time = time(); + $this->config = $this->createMock(IConfig::class); $this->resetDatabase(); - $this->mapper = new DefaultTokenMapper($this->dbConnection); + $this->mapper = new DefaultTokenMapper($this->dbConnection, $this->config); } private function resetDatabase() { -- cgit v1.2.3