‪TYPO3CMS  11.5
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;
22 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
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 
57  public function ‪getStorageFolders(string $settingsPages, int $settingsRecursive, array $expected): void
58  {
59  $this->cObj->method('getTreeList')
60  ->willReturnCallback([SettingsDataProvider::class, 'treeListMethodMock']);
61 
62  $this->subject->_set(
63  'settings',
64  [
65  'pages' => $settingsPages,
66  'recursive' => $settingsRecursive,
67  ]
68  );
69 
70  $actual = $this->subject->_call('getStorageFolders');
71  sort($actual);
72  self::assertEquals(
73  $expected,
74  $actual
75  );
76  }
77 }
‪TYPO3\CMS\FrontendLogin\Controller\AbstractLoginFormController
Definition: AbstractLoginFormController.php:26
‪TYPO3\CMS\FrontendLogin\Tests\Unit\Controller\AbstractLoginControllerTest\$cObj
‪MockObject ContentObjectRenderer $cObj
Definition: AbstractLoginControllerTest.php:31
‪TYPO3\CMS\FrontendLogin\Tests\Unit\Controller
Definition: AbstractLoginControllerTest.php:18
‪TYPO3\CMS\FrontendLogin\Tests\Unit\Controller\AbstractLoginControllerTest
Definition: AbstractLoginControllerTest.php:28
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:28
‪TYPO3\CMS\FrontendLogin\Tests\Unit\Controller\AbstractLoginControllerTest\setUp
‪setUp()
Definition: AbstractLoginControllerTest.php:37
‪TYPO3\CMS\FrontendLogin\Tests\Unit\Controller\AbstractLoginControllerTest\$subject
‪MockObject AbstractLoginFormController AccessibleObjectInterface $subject
Definition: AbstractLoginControllerTest.php:35
‪TYPO3\CMS\FrontendLogin\Tests\Unit\Controller\AbstractLoginControllerTest\getStorageFolders
‪getStorageFolders(string $settingsPages, int $settingsRecursive, array $expected)
Definition: AbstractLoginControllerTest.php:55