-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
512c81a
commit eedd9af
Showing
6 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ infection.log | |
/Tests/.phpunit.cache/ | ||
/Infection/ | ||
/LOGGER-HTML | ||
.Logs | ||
reports/ | ||
report/ | ||
tools/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ | |
|
||
/* | ||
* @internal | ||
* @codeCoverageIgnore | ||
*/ | ||
final class SystemSleeper implements SleeperInterface | ||
{ | ||
|
35 changes: 35 additions & 0 deletions
35
Tests/Functional/Configuration/ExtensionConfigurationProviderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AOE\Crawler\Tests\Functional\Configuration; | ||
|
||
/* | ||
* (c) 2024- Tomas Norre Mikkelsen <[email protected]> | ||
* | ||
* This file is part of the TYPO3 Crawler Extension. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
use AOE\Crawler\Configuration\ExtensionConfigurationProvider; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
class ExtensionConfigurationProviderTest extends FunctionalTestCase | ||
{ | ||
public function testExceptionIsThrownAndCatchedIfExtensionNotLoaded(): void | ||
{ | ||
$subject = GeneralUtility::makeInstance(ExtensionConfigurationProvider::class); | ||
|
||
self::assertIsArray($subject->getExtensionConfiguration()); | ||
self::assertEmpty($subject->getExtensionConfiguration()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* (c) 2024- Tomas Norre Mikkelsen <[email protected]> | ||
* | ||
* This file is part of the TYPO3 Crawler Extension. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace AOE\Crawler\Tests\Functional\ContextMenu; | ||
|
||
use AOE\Crawler\ContextMenu\ItemProvider; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; | ||
use TYPO3\CMS\Core\Localization\LanguageService; | ||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; | ||
|
||
class ItemProviderTest extends FunctionalTestCase | ||
{ | ||
protected array $testExtensionsToLoad = ['typo3conf/ext/crawler']; | ||
private $oldBackendUser; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$mockedLanguageService = self::getAccessibleMock(LanguageService::class, ['sL'], [], '', false); | ||
$mockedLanguageService->expects($this->any())->method('sL')->willReturn('language string'); | ||
$GLOBALS['LANG'] = $mockedLanguageService; | ||
$this->oldBackendUser = $GLOBALS['BE_USER'] ?? null; | ||
$backendUserStub = $this->createStub(BackendUserAuthentication::class); | ||
$GLOBALS['BE_USER'] = $backendUserStub; | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
if ($this->oldBackendUser) { | ||
$GLOBALS['BE_USER'] = $this->oldBackendUser; | ||
} else { | ||
unset($GLOBALS['BE_USER']); | ||
} | ||
} | ||
|
||
#[Test] | ||
public function addItemsContactsItems(): void | ||
{ | ||
$newItems = [ | ||
'other-ext' => [ | ||
'type' => 'item', | ||
'label' => 'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:contextMenu.label', | ||
'iconIdentifier' => 'tx-other-ext', | ||
'callbackAction' => 'other-ext-callback', | ||
], | ||
]; | ||
|
||
$subject = new ItemProvider(); | ||
self::assertArrayHasKey('crawler', $subject->addItems($newItems)); | ||
self::assertArrayHasKey('other-ext', $subject->addItems($newItems)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* (c) 2024- Tomas Norre Mikkelsen <[email protected]> | ||
* | ||
* This file is part of the TYPO3 Crawler Extension. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace AOE\Crawler\Tests\Unit\Helper; | ||
|
||
use AOE\Crawler\Helper\Sleeper\SystemSleeper; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase; | ||
|
||
#[CoversClass(SystemSleeper::class)] | ||
class SystemSleeperTest extends UnitTestCase | ||
{ | ||
public function testSystemSleeper(): void | ||
{ | ||
$startTime = date('s'); | ||
$subject = new SystemSleeper(); | ||
$subject->sleep(1); | ||
$endTime = date('s'); | ||
self::assertEquals(1, $endTime - $startTime); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters