Skip to content

Commit

Permalink
CI: Fix Rector (#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnorre authored Mar 7, 2024
1 parent 8dc81ae commit 81a72b4
Show file tree
Hide file tree
Showing 60 changed files with 381 additions and 777 deletions.
2 changes: 1 addition & 1 deletion Classes/Command/BuildQueueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
} else {
$output->writeln(
'<error>Error checking Crawler Result: ' . substr(
preg_replace('/\s+/', ' ', strip_tags((string) $resultContent)),
(string) preg_replace('/\s+/', ' ', strip_tags((string) $resultContent)),
0,
30000
) . '...' . PHP_EOL . '</error>' . PHP_EOL
Expand Down
7 changes: 3 additions & 4 deletions Classes/Service/BackendModuleScriptUrlService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ public function buildScriptUrl(
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$route = $request->getAttribute('route');
$scriptUrl = (string) $uriBuilder->buildUriFromRoute($route->getOption('_identifier'), $mainParams);
$scriptUrl .= $queryString . $this->getAdditionalQueryParams(

return $scriptUrl . ($queryString . $this->getAdditionalQueryParams(
$elementName,
$queryParameters
) . '&' . $elementName . '=${value}';

return $scriptUrl;
) . '&' . $elementName . '=${value}');
}

/*
Expand Down
6 changes: 2 additions & 4 deletions Tests/Functional/Command/BuildQueueCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ protected function setUp(): void
$this->commandTester = new CommandTester($command);
}

/**
* @test
* @dataProvider buildQueueCommandDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('buildQueueCommandDataProvider')]
#[\PHPUnit\Framework\Attributes\Test]
public function buildQueueCommandTest(array $parameters, string $expectedOutput, int $expectedCount): void
{
$arguments = [];
Expand Down
5 changes: 2 additions & 3 deletions Tests/Functional/Command/FlushQueueCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ protected function setUp(): void

/**
* This will test that the commands and output contains what needed, the cleanup it self isn't tested.
*
* @test
* @dataProvider flushQueueDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('flushQueueDataProvider')]
#[\PHPUnit\Framework\Attributes\Test]
public function flushQueueCommandTest(string $mode, string $expectedOutput, int $expectedCount): void
{
$arguments = ['mode' => $mode];
Expand Down
6 changes: 2 additions & 4 deletions Tests/Functional/Command/ProcessQueueCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ protected function setUp(): void
$this->commandTester = new CommandTester($command);
}

/**
* @test
* @dataProvider processQueueCommandDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('processQueueCommandDataProvider')]
#[\PHPUnit\Framework\Attributes\Test]
public function processQueueCommandTest(array $parameters, string $expectedOutput): void
{
$arguments = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class BackendModuleStartCrawlingControllerTest extends FunctionalTestCase

protected array $testExtensionsToLoad = ['typo3conf/ext/crawler'];

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function checkResponseOfHandleRequest(): never
{
$this->markTestSkipped('WIP');
Expand Down
27 changes: 8 additions & 19 deletions Tests/Functional/Controller/CrawlerControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ protected function setUp(): void
);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function getConfigurationsForBranch(): void
{
$GLOBALS['BE_USER'] = $this->getMockBuilder(BackendUserAuthentication::class)
Expand All @@ -95,10 +93,8 @@ public function getConfigurationsForBranch(): void
self::assertEquals($expected, $configurationsForBranch);
}

/**
* @test
* @dataProvider addUrlDataProvider
*/
#[\PHPUnit\Framework\Attributes\DataProvider('addUrlDataProvider')]
#[\PHPUnit\Framework\Attributes\Test]
public function addUrl(
int $id,
string $url,
Expand All @@ -110,18 +106,11 @@ public function addUrl(
bool $registerQueueEntriesInternallyOnly,
bool $expected
): void {
$typo3MajorVersion = (new Typo3Version())->getMajorVersion();
if ($typo3MajorVersion <= 11) {
$mockedQueueRepository = $this->getAccessibleMock(
QueueRepository::class,
['getDuplicateQueueItemsIfExists']
);
} else {
$mockedQueueRepository = $this->getAccessibleMock(
QueueRepository::class,
['getDuplicateQueueItemsIfExists']
);
}
(new Typo3Version())->getMajorVersion();
$mockedQueueRepository = $this->getAccessibleMock(
QueueRepository::class,
['getDuplicateQueueItemsIfExists']
);

$mockedQueueRepository->expects($this->any())->method('getDuplicateQueueItemsIfExists')->willReturn(
$mockedDuplicateRowResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,15 @@ protected function setUp(): void
$this->importCSVDataSet(__DIR__ . '/../../Fixtures/pages.csv');
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function getCrawlerConfigurationRecordsFromRootLineReturnsEmptyArray(): void
{
self::assertEmpty(
$this->subject->getCrawlerConfigurationRecordsFromRootLine(self::PAGE_WITHOUT_CONFIGURATIONS)
);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function getCrawlerConfigurationRecordsFromRootLineReturnsObjects(): void
{
$configurations = $this->subject->getCrawlerConfigurationRecordsFromRootLine(5);
Expand Down
48 changes: 12 additions & 36 deletions Tests/Functional/Domain/Repository/ProcessRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,19 @@ protected function setUp(): void
$this->importCSVDataSet(__DIR__ . '/../../Fixtures/tx_crawler_process.csv');
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findAllReturnsAll(): void
{
self::assertSame(6, $this->subject->findAll()->count());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findAllActiveReturnsActive(): void
{
self::assertSame(3, $this->subject->findAllActive()->count());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function removeByProcessId(): void
{
self::assertSame(6, $this->subject->findAll()->count());
Expand All @@ -100,25 +94,19 @@ public function removeByProcessId(): void
self::assertSame(5, $this->subject->findAll()->count());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function countNotTimeouted(): void
{
self::assertSame(2, $this->subject->countNotTimeouted(11));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function countAll(): void
{
self::assertSame(6, $this->subject->countAll());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function getActiveProcessesOlderThanOneOHour(): void
{
$expected = [
Expand All @@ -131,9 +119,7 @@ public function getActiveProcessesOlderThanOneOHour(): void
self::assertEquals($expected, $this->subject->getActiveProcessesOlderThanOneHour());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function getActiveOrphanProcesses(): void
{
$expected = [
Expand All @@ -146,9 +132,7 @@ public function getActiveOrphanProcesses(): void
self::assertEquals($expected, $this->subject->getActiveOrphanProcesses());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function deleteProcessesWithoutItemsAssigned(): void
{
$countBeforeDelete = $this->subject->findAll()->count();
Expand All @@ -158,9 +142,7 @@ public function deleteProcessesWithoutItemsAssigned(): void
self::assertSame($this->subject->findAll()->count(), $countBeforeDelete - $expectedProcessesToBeDeleted);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function deleteProcessesMarkedAsDeleted(): void
{
$countBeforeDelete = $this->subject->findAll()->count();
Expand All @@ -170,9 +152,7 @@ public function deleteProcessesMarkedAsDeleted(): void
self::assertSame($this->subject->findAll()->count(), $countBeforeDelete - $expectedProcessesToBeDeleted);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function markRequestedProcessesAsNotActive(): void
{
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching'] = [];
Expand All @@ -184,9 +164,7 @@ public function markRequestedProcessesAsNotActive(): void
self::assertEquals(1, $this->subject->findAllActive()->count());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function updateProcessAssignItemsCount(): void
{
$processBefore = $this->findByProcessId('1002');
Expand All @@ -198,9 +176,7 @@ public function updateProcessAssignItemsCount(): void
self::assertEquals(10, $processAfter['assigned_items_count']);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function addProcessAddProcess(): void
{
$processId = md5('processId');
Expand Down
Loading

0 comments on commit 81a72b4

Please sign in to comment.