/** * @test */ public function createValidationErrorMessageAddsErrorFlashMessageButNotInSessionInAjaxRequest() { $flashMessageQueueMock = $this->getMock(\TYPO3\CMS\Core\Messaging\FlashMessageQueue::class, array(), array(), '', false); $flashMessageQueueMock->expects($this->once())->method('enqueue')->with($this->isInstanceOf(\TYPO3\CMS\Core\Messaging\FlashMessage::class))->will($this->returnCallback(array($this, 'enqueueAjaxFlashMessageCallback'))); $languageServiceMock = $this->getMock(\TYPO3\CMS\Lang\LanguageService::class, array(), array(), '', false); $languageServiceMock->expects($this->once())->method('sL')->will($this->returnValue('foo')); FormProtectionFactory::getMessageClosure($languageServiceMock, $flashMessageQueueMock, true)->__invoke(); }