TYPO3 CMS  TYPO3_7-6
AbstractExceptionHandlerTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
23 {
30  {
31  return [
32  'url with valid token' => [
33  'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8ea206693b0d530ccd6b2b36',
34  'http://localhost/typo3/index.php?M=foo&moduleToken=--AnonymizedToken--'
35  ],
36  'url with valid token in the middle' => [
37  'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8ea206693b0d530ccd6b2b36&param=asdf',
38  'http://localhost/typo3/index.php?M=foo&moduleToken=--AnonymizedToken--&param=asdf'
39  ],
40  'url with invalid token' => [
41  'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8/e',
42  'http://localhost/typo3/index.php?M=foo&moduleToken=5f1f7d447f22886e8/e',
43  ],
44  'url with empty token' => [
45  'http://localhost/typo3/index.php?M=foo&moduleToken=',
46  'http://localhost/typo3/index.php?M=foo&moduleToken=',
47  ],
48  'url with no token' => [
49  'http://localhost/typo3/index.php?M=foo',
50  'http://localhost/typo3/index.php?M=foo',
51  ],
52  ];
53  }
54 
61  public function anonymizeTokenReturnsCorrectModifiedUrl($originalUrl, $expectedUrl)
62  {
63  $mock = $this->getAccessibleMockForAbstractClass(AbstractExceptionHandler::class, ['dummy']);
64  $anonymizedUrl = $mock->_call('anonymizeToken', $originalUrl);
65  $this->assertSame($expectedUrl, $anonymizedUrl);
66  }
67 }
getAccessibleMockForAbstractClass( $originalClassName, array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true, $mockedMethods=[])