TYPO3  7.6
LoginControllerTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\Controller;
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 
19 use TYPO3\CMS\Core\Tests\UnitTestCase;
20 
24 class LoginControllerTest extends UnitTestCase
25 {
30 
34  protected function setUp()
35  {
36  $this->loginControllerMock = $this->getAccessibleMock(LoginController::class, ['dummy'], [], '', false);
37  }
38 
45  {
46  unset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders']);
47  $this->loginControllerMock->_call('validateAndSortLoginProviders');
48  }
49 
56  {
57  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = 'foo';
58  $this->loginControllerMock->_call('validateAndSortLoginProviders');
59  }
60 
67  {
68  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [];
69  $this->loginControllerMock->_call('validateAndSortLoginProviders');
70  }
71 
78  {
79  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
80  1433419736 => []
81  ];
82  $this->loginControllerMock->_call('validateAndSortLoginProviders');
83  }
84 
91  {
92  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
93  1433419736 => [
94  'provider' => \stdClass::class
95  ]
96  ];
97  $this->loginControllerMock->_call('validateAndSortLoginProviders');
98  }
99 
106  {
107  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
108  1433419736 => [
109  'provider' => UsernamePasswordLoginProvider::class,
110  'sorting' => 30,
111  'icon-class' => 'foo'
112  ]
113  ];
114  $this->loginControllerMock->_call('validateAndSortLoginProviders');
115  }
116 
123  {
124  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
125  1433419736 => [
126  'provider' => UsernamePasswordLoginProvider::class,
127  'sorting' => 30,
128  'label' => 'foo'
129  ]
130  ];
131  $this->loginControllerMock->_call('validateAndSortLoginProviders');
132  }
133 
140  {
141  $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'] = [
142  1433419736 => [
143  'provider' => UsernamePasswordLoginProvider::class,
144  'label' => 'foo',
145  'icon-class' => 'foo'
146  ]
147  ];
148  $this->loginControllerMock->_call('validateAndSortLoginProviders');
149  }
150 }