/**
  * Sets up this test case
  */
 public function setUp()
 {
     $this->securityContext = $this->getAccessibleMock(Context::class, ['separateActiveAndInactiveTokens']);
     $this->mockAuthenticationManager = $this->createMock(AuthenticationManagerInterface::class);
     $this->mockAuthenticationManager->expects($this->any())->method('getTokens')->will($this->returnValue([]));
     $this->securityContext->injectAuthenticationManager($this->mockAuthenticationManager);
     $this->mockActionRequest = $this->getMockBuilder(ActionRequest::class)->disableOriginalConstructor()->getMock();
     $this->securityContext->setRequest($this->mockActionRequest);
 }
 /**
  * @test
  */
 public function csrfTokenFieldIsRenderedForUnsafeRequests()
 {
     /** @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->any())->method('isInitialized')->will($this->returnValue(true));
     $this->mockAuthenticationManager->expects($this->any())->method('isAuthenticated')->will($this->returnValue(true));
     $this->securityContext->expects($this->atLeastOnce())->method('getCsrfProtectionToken')->will($this->returnValue('CSRFTOKEN'));
     $this->assertEquals('<input type="hidden" name="__csrfToken" value="CSRFTOKEN" />' . chr(10), $viewHelper->_call('renderCsrfTokenField'));
 }