request = $this->createMock(IRequest::class); $this->tokenManager = $this->createMock(CsrfTokenManager::class); $this->controller = new CSRFTokenController('core', $this->request, $this->tokenManager); } public function testGetToken(): void { $this->request->method('passesStrictCookieCheck')->willReturn(true); $token = $this->createMock(CsrfToken::class); $this->tokenManager->method('getToken')->willReturn($token); $token->method('getEncryptedValue')->willReturn('toktok123'); $response = $this->controller->index(); $this->assertInstanceOf(JSONResponse::class, $response); $this->assertSame(Http::STATUS_OK, $response->getStatus()); $this->assertEquals([ 'token' => 'toktok123' ], $response->getData()); } public function testGetTokenNoStrictSameSiteCookie(): void { $this->request->method('passesStrictCookieCheck')->willReturn(false); $response = $this->controller->index(); $this->assertInstanceOf(JSONResponse::class, $response); $this->assertSame(Http::STATUS_FORBIDDEN, $response->getStatus()); } } value='OlliTietavainenVaadin-patch-2'>OlliTietavainenVaadin-patch-2 Vaadin 6, 7, 8 is a Java framework for modern Java web applications: https://github.com/vaadin/frameworkwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/.classpath
blob: 027a399de87b52dbf2ec32225ebf974390ac559f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15