Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/UserSessionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use TYPO3\CMS\Core\Utility\GeneralUtility;

/**
* Class FrontendUserSessionRepository
* Class UserSessionRepository
*/
class UserSessionRepository
{
Expand Down
58 changes: 58 additions & 0 deletions Classes/Modules/Debug/InternalContentObjects.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);

namespace Psychomieze\AdminpanelExtended\Modules\Debug;

/*
* This file is part of the TYPO3 Adminpanel Initiative.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

use TYPO3\CMS\Adminpanel\ModuleApi\AbstractSubModule;
use TYPO3\CMS\Adminpanel\ModuleApi\ContentProviderInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;

/**
* Class InternalContentObjects
*/
class InternalContentObjects extends AbstractSubModule implements ContentProviderInterface
{
/**
* Identifier for this module,
* for example "preview" or "cache"
*
* @return string
*/
public function getIdentifier(): string
{
return 'internal-content-objects';
}

/**
* Module label
*
* @return string
*/
public function getLabel(): string
{
return $this->getLanguageService()->sL(
'LLL:EXT:adminpanel_extended/Resources/Private/Language/locallang_debug.xlf:submodule.internalContentObjects.label'
);
}

/**
* Main method for content generation of an admin panel module.
* Return content as HTML. For modules implementing the DataProviderInterface
* the "ModuleData" object is automatically filled with the stored data - if
* no data is given a "fresh" ModuleData object is injected.
*
* @param \TYPO3\CMS\Adminpanel\ModuleApi\ModuleData $data
* @return string
*/
public function getContent(ModuleData $data): string
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid unused parameters such as '$data'.

{
return '';
}
}
12 changes: 8 additions & 4 deletions Classes/Modules/Info/UserInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ class UserInformation extends AbstractSubModule implements DataProviderInterface
*/
private $backendUserSessionRepository;

public function __construct(UserSessionRepository $frontendUserSessionRepository = null, UserSessionRepository $backendUserSessionRepository = null)
{
$this->frontendUserSessionRepository = $frontendUserSessionRepository ?? GeneralUtility::makeInstance(UserSessionRepository::class, UserSessionRepository::CONTEXT_FE);
$this->backendUserSessionRepository = $backendUserSessionRepository ?? GeneralUtility::makeInstance(UserSessionRepository::class, UserSessionRepository::CONTEXT_BE);
public function __construct(
UserSessionRepository $frontendUserSessionRepository = null,
UserSessionRepository $backendUserSessionRepository = null
) {
$this->frontendUserSessionRepository = $frontendUserSessionRepository ?? GeneralUtility::makeInstance(UserSessionRepository::class,
UserSessionRepository::CONTEXT_FE);
$this->backendUserSessionRepository = $backendUserSessionRepository ?? GeneralUtility::makeInstance(UserSessionRepository::class,
UserSessionRepository::CONTEXT_BE);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang_debug.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<trans-unit id="submodule.hooks.label">
<source>Hooks</source>
</trans-unit>
<trans-unit id="submodule.internalContentObjects.label">
<source>Internal Content Objects</source>
</trans-unit>
</body>
</file>
</xliff>
55 changes: 55 additions & 0 deletions Tests/Unit/Modules/Debug/InternalContentObjectsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);

namespace Psychomieze\AdminpanelExtended\Tests\Unit\Modules\Debug;

/*
* This file is part of the TYPO3 Adminpanel Initiative.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

use Psychomieze\AdminpanelExtended\Modules\Debug\InternalContentObjects;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

/**
* Class InternalContentObjectsTest
*/
class InternalContentObjectsTest extends UnitTestCase
{
/**
* @var \Psychomieze\AdminpanelExtended\Modules\Debug\InternalContentObjects
*/
protected $subject;

protected function setUp(): void
{
parent::setUp();
$this->subject = new InternalContentObjects();
}

/**
* @test
*/
public function getIdentifierReturnsUniqueSubModuleIdentifier(): void
{
static::assertSame('internal-content-objects', $this->subject->getIdentifier());
}

/**
* @test
*/
public function getLabelShouldCallLanguageServiceForLocalizedLanguageLabel(): void
{
$languageServiceProphecy = $this->prophesize(LanguageService::class);
$labelIdentifier = 'LLL:EXT:adminpanel_extended/Resources/Private/Language/locallang_debug.xlf:submodule.internalContentObjects.label';
$languageServiceProphecy->sL($labelIdentifier)->willReturn('some LLL');
$GLOBALS['LANG'] = $languageServiceProphecy->reveal();

$this->subject->getLabel();

$languageServiceProphecy->sL($labelIdentifier)->shouldHaveBeenCalledTimes(1);
}
}
1 change: 0 additions & 1 deletion Tests/Unit/Modules/Info/UserInformationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\ModuleData;
use TYPO3\CMS\Adminpanel\ModuleApi\ResourceProviderInterface;
use TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
Expand Down
13 changes: 8 additions & 5 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ function () {
[
'hooks' => [
'module' => \Psychomieze\AdminpanelExtended\Modules\HooksAndSignals\Hooks::class,
'after' => [
'log',
],
'after' => ['log']
],
'signals' => [
'module' => \Psychomieze\AdminpanelExtended\Modules\HooksAndSignals\Signals::class,
'after' => ['hooks'],
'after' => ['hooks']
],
'internal-content-objects' => [
'module' => Psychomieze\AdminpanelExtended\Modules\Debug\InternalContentObjects::class,
'after' => ['signals']
]
]
);
}
Expand All @@ -27,7 +29,8 @@ function () {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']['info']['submodules'],
[
'userinformation' => [
'module' => Psychomieze\AdminpanelExtended\Modules\Info\UserInformation::class
'module' => Psychomieze\AdminpanelExtended\Modules\Info\UserInformation::class,
'after' => ['request']
]
]
);
Expand Down