mirror of
https://github.com/nextcloud/server.git
synced 2026-04-29 18:11:41 -04:00
Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
83c1d1ef3a
commit
ad55d3b4c0
2 changed files with 10 additions and 2 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue