Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
c90d832ce4
commit
e6a0ad4701
3 changed files with 12 additions and 2 deletions
|
@ -32,6 +32,7 @@ use OCP\Http\Client\IClient;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
use OCP\Http\Client\IResponse;
|
use OCP\Http\Client\IResponse;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
use OCP\ILogger;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
class AppFetcherTest extends TestCase {
|
class AppFetcherTest extends TestCase {
|
||||||
|
@ -43,6 +44,8 @@ class AppFetcherTest extends TestCase {
|
||||||
protected $timeFactory;
|
protected $timeFactory;
|
||||||
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
|
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
protected $logger;
|
||||||
/** @var AppFetcher */
|
/** @var AppFetcher */
|
||||||
protected $fetcher;
|
protected $fetcher;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
@ -64,6 +67,7 @@ EOD;
|
||||||
$this->clientService = $this->createMock(IClientService::class);
|
$this->clientService = $this->createMock(IClientService::class);
|
||||||
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
||||||
$this->config = $this->createMock(IConfig::class);
|
$this->config = $this->createMock(IConfig::class);
|
||||||
|
$this->logger = $this->createMock(ILogger::class);
|
||||||
|
|
||||||
$this->config
|
$this->config
|
||||||
->expects($this->at(0))
|
->expects($this->at(0))
|
||||||
|
@ -74,7 +78,8 @@ EOD;
|
||||||
$factory,
|
$factory,
|
||||||
$this->clientService,
|
$this->clientService,
|
||||||
$this->timeFactory,
|
$this->timeFactory,
|
||||||
$this->config
|
$this->config,
|
||||||
|
$this->logger
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,8 @@ class CategoryFetcherTest extends FetcherBase {
|
||||||
$this->appDataFactory,
|
$this->appDataFactory,
|
||||||
$this->clientService,
|
$this->clientService,
|
||||||
$this->timeFactory,
|
$this->timeFactory,
|
||||||
$this->config
|
$this->config,
|
||||||
|
$this->logger
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ use OCP\Http\Client\IClient;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
use OCP\Http\Client\IResponse;
|
use OCP\Http\Client\IResponse;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
use OCP\ILogger;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
|
||||||
abstract class FetcherBase extends TestCase {
|
abstract class FetcherBase extends TestCase {
|
||||||
|
@ -45,6 +46,8 @@ abstract class FetcherBase extends TestCase {
|
||||||
protected $timeFactory;
|
protected $timeFactory;
|
||||||
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
|
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
/** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
|
protected $logger;
|
||||||
/** @var Fetcher */
|
/** @var Fetcher */
|
||||||
protected $fetcher;
|
protected $fetcher;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
@ -63,6 +66,7 @@ abstract class FetcherBase extends TestCase {
|
||||||
$this->clientService = $this->createMock(IClientService::class);
|
$this->clientService = $this->createMock(IClientService::class);
|
||||||
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
||||||
$this->config = $this->createMock(IConfig::class);
|
$this->config = $this->createMock(IConfig::class);
|
||||||
|
$this->logger = $this->createMock(ILogger::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {
|
public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {
|
||||||
|
|
Loading…
Reference in a new issue