public function csrfTokenFieldIsNotRenderedIfSecurityContextIsNotInitialized() { /** @var FormViewHelper|\PHPUnit_Framework_MockObject_MockObject $viewHelper */ $viewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\FormViewHelper::class, null, array(), '', false); $this->injectDependenciesIntoViewHelper($viewHelper); $this->securityContext->expects($this->atLeastOnce())->method('isInitialized')->will($this->returnValue(false)); $this->mockAuthenticationManager->expects($this->any())->method('isAuthenticated')->will($this->returnValue(true)); $this->securityContext->expects($this->never())->method('getCsrfProtectionToken'); $this->assertEquals('', $viewHelper->_call('renderCsrfTokenField')); }