‪TYPO3CMS  10.4
AbstractLoginControllerTest.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\MockObject\MockObject;
24 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
25 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
26 
27 class ‪AbstractLoginControllerTest extends UnitTestCase
28 {
32  protected ‪$cObj;
33 
37  protected ‪$subject;
38 
39  protected function ‪setUp(): void
40  {
41  parent::setUp();
42 
43  $this->subject = $this->getAccessibleMockForAbstractClass(AbstractLoginFormController::class);
44  $this->cObj = $this->createMock(ContentObjectRenderer::class);
45  $configurationManager = $this->createMock(ConfigurationManagerInterface::class);
46  $configurationManager->method('getContentObject')->willReturn($this->cObj);
47  $this->subject->_set('configurationManager', $configurationManager);
48  }
49 
56  public function ‪testGetStorageFolders(string $settingsPages, int $settingsRecursive, array $expected): void
57  {
58  $this->cObj->method('getTreeList')
59  ->willReturnCallback([SettingsDataProvider::class, 'treeListMethodMock']);
60 
61  $this->subject->_set(
62  'settings',
63  [
64  'pages' => $settingsPages,
65  'recursive' => $settingsRecursive,
66  ]
67  );
68 
69  $actual = $this->subject->_call('getStorageFolders');
70  sort($actual);
71  self::assertEquals(
72  $expected,
73  $actual
74  );
75  }
76 }
‪TYPO3\CMS\Felogin\Tests\Unit\Controller\AbstractLoginControllerTest\$cObj
‪MockObject ContentObjectRenderer $cObj
Definition: AbstractLoginControllerTest.php:31
‪TYPO3\CMS\Felogin\Tests\Unit\Controller\AbstractLoginControllerTest
Definition: AbstractLoginControllerTest.php:28
‪TYPO3\CMS\FrontendLogin\Controller\AbstractLoginFormController
Definition: AbstractLoginFormController.php:26
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:28
‪TYPO3\CMS\Felogin\Tests\Unit\Controller\AbstractLoginControllerTest\testGetStorageFolders
‪testGetStorageFolders(string $settingsPages, int $settingsRecursive, array $expected)
Definition: AbstractLoginControllerTest.php:54
‪TYPO3\CMS\Felogin\Tests\Unit\Controller\AbstractLoginControllerTest\setUp
‪setUp()
Definition: AbstractLoginControllerTest.php:37
‪TYPO3\CMS\Felogin\Tests\Unit\Controller
Definition: AbstractLoginControllerTest.php:18
‪TYPO3\CMS\Felogin\Tests\Unit\Controller\AbstractLoginControllerTest\$subject
‪MockObject AbstractLoginFormController AccessibleObjectInterface $subject
Definition: AbstractLoginControllerTest.php:35
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:97