17 use Prophecy\Argument;
18 use Psr\Log\LoggerInterface;
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
36 protected function setUp()
38 $this->subject = $this->getMockBuilder(\
TYPO3\CMS\Core\Error\DebugExceptionHandler::class)
39 ->setMethods([
'sendStatusHeaders',
'writeLogEntries'])
40 ->disableOriginalConstructor()
49 $message =
'<b>b</b><script>alert(1);</script>';
50 $exception = new \Exception($message, 1476049363);
52 $this->subject->echoExceptionWeb($exception);
55 $this->assertContains(htmlspecialchars($message),
$output);
56 $this->assertNotContains($message,
$output);
67 'url with valid token' => [
68 'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8ea206693b0d530ccd6b2b36',
69 'http://localhost/typo3/index.php?M=foo&moduleToken=--AnonymizedToken--'
71 'url with valid token in the middle' => [
72 'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8ea206693b0d530ccd6b2b36¶m=asdf',
73 'http://localhost/typo3/index.php?M=foo&moduleToken=--AnonymizedToken--¶m=asdf'
75 'url with invalid token' => [
76 'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8/e',
77 'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8/e',
79 'url with empty token' => [
80 'http://localhost/typo3/index.php?M=foo&moduleToken=',
81 'http://localhost/typo3/index.php?M=foo&moduleToken=',
83 'url with no token' => [
84 'http://localhost/typo3/index.php?M=foo',
85 'http://localhost/typo3/index.php?M=foo',
99 $logger = $this->prophesize(LoggerInterface::class);
100 $logger->critical(Argument::containingString($expectedUrl), Argument::cetera())->shouldBeCalled();
103 GeneralUtility::setIndpEnv(
'TYPO3_REQUEST_URL', $originalUrl);
105 $exception = new \Exception(
'message', 1476049367);