config = $this->createMock(IAppConfig::class); $this->request = $this->createMock(RequestInterface::class); $this->response = $this->createMock(ResponseInterface::class); $this->plugin = new CalDavValidatePlugin( $this->config, ); } public function testPutSizeLessThenLimit(): void { // construct method responses $this->config ->method('getValueInt') ->with('dav', 'event_size_limit', 10485760) ->willReturn(10485760); $this->request ->method('getRawServerValue') ->with('CONTENT_LENGTH') ->willReturn('1024'); // test condition $this->assertTrue( $this->plugin->beforePut($this->request, $this->response) ); } public function testPutSizeMoreThenLimit(): void { // construct method responses $this->config ->method('getValueInt') ->with('dav', 'event_size_limit', 10485760) ->willReturn(10485760); $this->request ->method('getRawServerValue') ->with('CONTENT_LENGTH') ->willReturn('16242880'); $this->expectException(Forbidden::class); // test condition $this->plugin->beforePut($this->request, $this->response); } }