refactor: Migrate away from deprecated ILogger interface to PSR-3
Mostly replace `ILogger` with `LoggerInterface` and some minor cleanup (constructor property promotion). Some places used the deprecated `logException` this is easy to migrate by simply use the appropriate loglevel on the logger and place the exception under the `exception` key in the context. Also the manual checking of the configured log level is not needed, as this is already done by the logger. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
@@ -32,21 +32,20 @@ use OCA\Deck\Service\PermissionService;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\JSONResponse;
|
||||
use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
use OCP\IRequest;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ExceptionMiddlewareTest extends \Test\TestCase {
|
||||
|
||||
/** @var ILogger */
|
||||
private $logger;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
private $request;
|
||||
private $controller;
|
||||
private LoggerInterface&MockObject $logger;
|
||||
private IConfig&MockObject $config;
|
||||
private IRequest&MockObject $request;
|
||||
private Controller&MockObject $controller;
|
||||
private $exceptionMiddleware;
|
||||
|
||||
public function setUp(): void {
|
||||
$this->logger = $this->createMock(ILogger::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->request = $this->createMock(IRequest::class);
|
||||
$this->controller = $this->createMock(Controller::class);
|
||||
|
||||
Reference in New Issue
Block a user