mirror of
https://github.com/nextcloud/server.git
synced 2026-03-21 18:11:02 -04:00
fix(tests): Fix PHP warnings in tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
ac61839d1e
commit
cba4f1b616
3 changed files with 26 additions and 18 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,6 +308,12 @@ class ViewControllerTest extends TestCase {
|
|||
}
|
||||
});
|
||||
|
||||
$this->config
|
||||
->method('getUserValue')
|
||||
->willReturnMap([
|
||||
[$this->user->getUID(), 'files', 'files_sorting_configs', '{}', '{}'],
|
||||
]);
|
||||
|
||||
$this->viewController->index('', '', null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue