[!!!][TASK] Remove sysext:sv, move files to sysext:core
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / Authentication / AuthenticationServiceTest.php
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Core\Tests\Functional\Authentication;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17 use TYPO3\CMS\Core\Authentication\AuthenticationService;
18 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
19
20 /**
21 * Testcase for class \TYPO3\CMS\Core\Authentication\AuthenticationService
22 */
23 class AuthenticationServiceTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
24 {
25 /**
26 * @var AuthenticationService
27 */
28 protected $subject;
29
30 protected function setUp()
31 {
32 $this->subject = new AuthenticationService();
33 parent::setUp();
34 $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/be_users.xml');
35 }
36
37 /**
38 * @test
39 */
40 public function getUserReturnsOnlyNotDeletedRecords()
41 {
42 $this->subject->pObj = new BackendUserAuthentication();
43 $this->subject->login = [
44 'status' => 'login',
45 'uname' => 'test1',
46 'uident' => 'password',
47 'uident_text' => 'password',
48 ];
49 $this->subject->db_user = [
50 'table' => 'be_users',
51 'check_pid_clause' => '',
52 'enable_clause' => '',
53 'username_column' => 'username',
54 ];
55 $expected = [
56 'username' => 'test1',
57 'deleted' => 0
58 ];
59 $result = $this->subject->getUser();
60 $this->assertArraySubset($expected, $result);
61 }
62 }