Skip to content
Closed
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
Next Next commit
Fix tests
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and backportbot[bot] committed Mar 2, 2022
commit 0de7d3eb1a2ac821e342fcc338612175262de011
27 changes: 20 additions & 7 deletions tests/lib/AppFramework/Http/DispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
use OCP\Diagnostics\IEventLogger;
use OCP\IConfig;
use OCP\IRequest;
use PHPUnit\Framework\MockObject\MockObject;
Expand Down Expand Up @@ -99,13 +100,18 @@ class DispatcherTest extends \Test\TestCase {
private $config;
/** @var LoggerInterface|MockObject */
private $logger;
/**
* @var IEventLogger|MockObject
*/
private $eventLogger;

protected function setUp(): void {
parent::setUp();
$this->controllerMethod = 'test';

$this->config = $this->createMock(IConfig::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->eventLogger = $this->createMock(IEventLogger::class);
$app = $this->getMockBuilder(
'OC\AppFramework\DependencyInjection\DIContainer')
->disableOriginalConstructor()
Expand Down Expand Up @@ -143,7 +149,8 @@ protected function setUp(): void {
$this->request,
$this->config,
\OC::$server->getDatabaseConnection(),
$this->logger
$this->logger,
$this->eventLogger
);

$this->response = $this->createMock(Response::class);
Expand Down Expand Up @@ -321,7 +328,8 @@ public function testControllerParametersInjected() {
$this->request,
$this->config,
\OC::$server->getDatabaseConnection(),
$this->logger
$this->logger,
$this->eventLogger
);
$controller = new TestController('app', $this->request);

Expand Down Expand Up @@ -355,7 +363,8 @@ public function testControllerParametersInjectedDefaultOverwritten() {
$this->request,
$this->config,
\OC::$server->getDatabaseConnection(),
$this->logger
$this->logger,
$this->eventLogger
);
$controller = new TestController('app', $this->request);

Expand Down Expand Up @@ -392,7 +401,8 @@ public function testResponseTransformedByUrlFormat() {
$this->request,
$this->config,
\OC::$server->getDatabaseConnection(),
$this->logger
$this->logger,
$this->eventLogger
);
$controller = new TestController('app', $this->request);

Expand Down Expand Up @@ -428,7 +438,8 @@ public function testResponseTransformsDataResponse() {
$this->request,
$this->config,
\OC::$server->getDatabaseConnection(),
$this->logger
$this->logger,
$this->eventLogger
);
$controller = new TestController('app', $this->request);

Expand Down Expand Up @@ -465,7 +476,8 @@ public function testResponseTransformedByAcceptHeader() {
$this->request,
$this->config,
\OC::$server->getDatabaseConnection(),
$this->logger
$this->logger,
$this->eventLogger
);
$controller = new TestController('app', $this->request);

Expand Down Expand Up @@ -504,7 +516,8 @@ public function testResponsePrimarilyTransformedByParameterFormat() {
$this->request,
$this->config,
\OC::$server->getDatabaseConnection(),
$this->logger
$this->logger,
$this->eventLogger
);
$controller = new TestController('app', $this->request);

Expand Down
11 changes: 9 additions & 2 deletions tests/lib/Diagnostics/EventLoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,25 @@

namespace Test\Diagnostics;

use Psr\Log\LoggerInterface;
use OC\Diagnostics\EventLogger;
use OC\Log;
use OC\SystemConfig;
use Test\TestCase;

class EventLoggerTest extends TestCase {

/** @var \OC\Diagnostics\EventLogger */
private $logger;

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

$this->logger = new EventLogger();
$this->logger = new EventLogger(
$this->createMock(SystemConfig::class),
$this->createMock(LoggerInterface::class),
$this->createMock(Log::class)
);
}

public function testQueryLogger() {
Expand Down