[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / sv / Tests / Unit / AuthenticationServiceTest.php
1 <?php
2 namespace TYPO3\CMS\Sv\Tests\Unit;
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
17 /**
18 * Testcase for class \TYPO3\CMS\Sv\AuthenticationService
19 *
20 */
21 class AuthenticationServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
22
23 /**
24 * Date provider for processLoginReturnsCorrectData
25 *
26 * @return array
27 */
28 public function processLoginDataProvider() {
29 return array(
30 'Backend login with securityLevel "normal"' => array(
31 'normal',
32 array(
33 'status' => 'login',
34 'uname' => 'admin',
35 'uident' => 'password',
36 'chalvalue' => NULL
37 ),
38 array(
39 'status' => 'login',
40 'uname' => 'admin',
41 'uident' => 'password',
42 'chalvalue' => NULL,
43 'uident_text' => 'password',
44 'uident_challenged' => '458203772635d38f05ca9e62d8237974',
45 'uident_superchallenged' => '651219fccfbe0c9004c7196515d780ce'
46 )
47 ),
48 'Backend login with securityLevel "superchallenged"' => array(
49 'superchallenged',
50 array(
51 'status' => 'login',
52 'uname' => 'admin',
53 'uident' => '651219fccfbe0c9004c7196515d780ce',
54 'chalvalue' => NULL
55 ),
56 array(
57 'status' => 'login',
58 'uname' => 'admin',
59 'uident' => '651219fccfbe0c9004c7196515d780ce',
60 'chalvalue' => NULL,
61 'uident_text' => '',
62 'uident_challenged' => '',
63 'uident_superchallenged' => '651219fccfbe0c9004c7196515d780ce'
64 )
65 ),
66 'Frontend login with securityLevel "normal"' => array(
67 'normal',
68 array(
69 'status' => 'login',
70 'uname' => 'admin',
71 'uident' => 'password',
72 'chalvalue' => NULL
73 ),
74 array(
75 'status' => 'login',
76 'uname' => 'admin',
77 'uident' => 'password',
78 'chalvalue' => NULL,
79 'uident_text' => 'password',
80 'uident_challenged' => '458203772635d38f05ca9e62d8237974',
81 'uident_superchallenged' => '651219fccfbe0c9004c7196515d780ce'
82 )
83 ),
84 'Frontend login with securityLevel "challenged"' => array(
85 'challenged',
86 array(
87 'status' => 'login',
88 'uname' => 'admin',
89 'uident' => '458203772635d38f05ca9e62d8237974',
90 'chalvalue' => NULL
91 ),
92 array(
93 'status' => 'login',
94 'uname' => 'admin',
95 'uident' => '458203772635d38f05ca9e62d8237974',
96 'chalvalue' => NULL,
97 'uident_text' => '',
98 'uident_challenged' => '458203772635d38f05ca9e62d8237974',
99 'uident_superchallenged' => ''
100 )
101 )
102 );
103 }
104
105 /**
106 * @test
107 * @dataProvider processLoginDataProvider
108 */
109 public function processLoginReturnsCorrectData($passwordSubmissionStrategy, $loginData, $expectedProcessedData) {
110 /** @var $authenticationService \TYPO3\CMS\Sv\AuthenticationService */
111 $authenticationService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Sv\\AuthenticationService');
112 // Login data is modified by reference
113 $authenticationService->processLoginData($loginData, $passwordSubmissionStrategy);
114 $this->assertEquals($expectedProcessedData, $loginData);
115 }
116
117 }