Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix unit tests
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jan 31, 2022
commit a429f02a6249287f1819d5455afdef635ad92a7a
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
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 {
Expand All @@ -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() {
Expand Down
7 changes: 6 additions & 1 deletion tests/lib/Authentication/Token/DefaultTokenMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
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;

/**
Expand All @@ -44,16 +46,19 @@ class DefaultTokenMapperTest extends TestCase {

/** @var IDBConnection */
private $dbConnection;
/** @var IConfig|MockObject */
private $config;
private $time;

protected function setUp(): void {
parent::setUp();

$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() {
Expand Down