|
|
@ -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); |
|
|
|
} |
|
|
|
} |