‪TYPO3CMS  ‪main
AuthenticationServiceTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
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 
19 
20 use PHPUnit\Framework\Attributes\Test;
21 use Psr\Log\NullLogger;
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
25 
29 final class ‪AuthenticationServiceTest extends FunctionalTestCase
30 {
34  protected ‪$subject;
35 
36  protected function ‪setUp(): void
37  {
38  $this->subject = new ‪AuthenticationService();
39  $this->subject->setLogger(new NullLogger());
40  parent::setUp();
41  $this->importCSVDataSet(__DIR__ . '/../../../../core/Tests/Functional/Fixtures/be_users.csv');
42  }
43 
44  #[Test]
45  public function ‪getUserReturnsOnlyNotDeletedRecords(): void
46  {
47  $this->subject->pObj = new ‪BackendUserAuthentication();
48  $this->subject->login = [
49  'status' => 'login',
50  'uname' => 'test1',
51  'uident' => 'password',
52  'uident_text' => 'password',
53  ];
54  $this->subject->db_user = [
55  'table' => 'be_users',
56  'userid_column' => 'uid',
57  'enable_clause' => '',
58  'username_column' => 'username',
59  ];
60  $result = $this->subject->getUser();
61  self::assertSame('test1', $result['username']);
62  self::assertSame(0, (int)$result['deleted']);
63  }
64 }
‪TYPO3\CMS\Core\Tests\Functional\Authentication\AuthenticationServiceTest\setUp
‪setUp()
Definition: AuthenticationServiceTest.php:35
‪TYPO3\CMS\Core\Tests\Functional\Authentication\AuthenticationServiceTest
Definition: AuthenticationServiceTest.php:30
‪TYPO3\CMS\Core\Tests\Functional\Authentication\AuthenticationServiceTest\$subject
‪AuthenticationService $subject
Definition: AuthenticationServiceTest.php:33
‪TYPO3\CMS\Core\Tests\Functional\Authentication
Definition: AbstractUserAuthenticationTest.php:18
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Core\Authentication\AuthenticationService
Definition: AuthenticationService.php:32
‪TYPO3\CMS\Core\Tests\Functional\Authentication\AuthenticationServiceTest\getUserReturnsOnlyNotDeletedRecords
‪getUserReturnsOnlyNotDeletedRecords()
Definition: AuthenticationServiceTest.php:44