fix(tests): Fix PHP warnings in tests

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2025-09-09 11:03:34 +02:00
parent ac61839d1e
commit cba4f1b616
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
3 changed files with 26 additions and 18 deletions

View file

@ -34,6 +34,7 @@ class UserEventsListenerTest extends TestCase {
private ExampleContactService&MockObject $exampleContactService;
private ExampleEventService&MockObject $exampleEventService;
private LoggerInterface&MockObject $logger;
private IJobList&MockObject $jobList;
private UserEventsListener $userEventsListener;

View file

@ -20,11 +20,29 @@ use Sabre\HTTP\ResponseInterface;
use Test\TestCase;
class UploadAutoMkcolPluginTest extends TestCase {
private Tree&MockObject $tree;
private RequestInterface&MockObject $request;
private ResponseInterface&MockObject $response;
private UploadAutoMkcolPlugin $plugin;
protected function setUp(): void {
parent::setUp();
$server = $this->createMock(Server::class);
$this->tree = $this->createMock(Tree::class);
$server->tree = $this->tree;
$this->plugin = new UploadAutoMkcolPlugin();
$this->request = $this->createMock(RequestInterface::class);
$this->response = $this->createMock(ResponseInterface::class);
$server->httpRequest = $this->request;
$server->httpResponse = $this->response;
$this->plugin->initialize($server);
}
public static function dataMissingHeaderShouldReturnTrue(): Generator {
yield 'missing X-NC-WebDAV-Auto-Mkcol header' => [null];
yield 'empty X-NC-WebDAV-Auto-Mkcol header' => [''];
@ -113,21 +131,4 @@ class UploadAutoMkcolPluginTest extends TestCase {
$return = $this->plugin->beforeMethod($this->request, $this->response);
self::assertTrue($return);
}
protected function setUp(): void {
parent::setUp();
$server = $this->createMock(Server::class);
$this->tree = $this->createMock(Tree::class);
$server->tree = $this->tree;
$this->plugin = new UploadAutoMkcolPlugin();
$this->request = $this->createMock(RequestInterface::class);
$this->response = $this->createMock(ResponseInterface::class);
$server->httpRequest = $this->request;
$server->httpResponse = $this->response;
$this->plugin->initialize($server);
}
}

View file

@ -308,6 +308,12 @@ class ViewControllerTest extends TestCase {
}
});
$this->config
->method('getUserValue')
->willReturnMap([
[$this->user->getUID(), 'files', 'files_sorting_configs', '{}', '{}'],
]);
$this->viewController->index('', '', null);
}
}