summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-02-16 11:24:33 +0100
committerGitHub <noreply@github.com>2022-02-16 11:24:33 +0100
commit287d058a57b0853ff6e79fd0dd78c3754facc2ae (patch)
tree4fe7c743c833ac22f70cdda37c883430d3ae3a1d /tests/lib
parentb9a56ee753ce96a6ed9cd3176e3e5cd891db26cd (diff)
parenta429f02a6249287f1819d5455afdef635ad92a7a (diff)
downloadnextcloud-server-287d058a57b0853ff6e79fd0dd78c3754facc2ae.tar.gz
nextcloud-server-287d058a57b0853ff6e79fd0dd78c3754facc2ae.zip
Merge pull request #30949 from nextcloud/bugfix/noid/allow-to-disable-v1-authtokens
[stable23] Allow to disable AuthToken v1
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php5
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenMapperTest.php7
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() {