diff options
author | Joas Schilling <coding@schilljs.com> | 2022-01-31 20:36:06 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-01-31 20:36:06 +0100 |
commit | a429f02a6249287f1819d5455afdef635ad92a7a (patch) | |
tree | 9559f16c5b3e4de40385009887bd3b8b5c63124e | |
parent | a5d8b1aa356c54f3eea6ecfba64820c7103d0bc1 (diff) | |
download | nextcloud-server-a429f02a6249287f1819d5455afdef635ad92a7a.tar.gz nextcloud-server-a429f02a6249287f1819d5455afdef635ad92a7a.zip |
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php | 5 | ||||
-rw-r--r-- | 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() { |