Skip to content

Commit

Permalink
[TASK] Remove PHPUnit Test Deprecations from Tests (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnorre authored Jul 9, 2024
1 parent 936a17f commit b2efa98
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 64 deletions.
56 changes: 28 additions & 28 deletions Tests/Functional/Domain/Repository/QueueRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,15 @@ public function flushQueue(QueueFilter $queueFilter, int $expected): void
public static function flushQueueDataProvider(): iterable
{
yield 'Flush Entire Queue' => [
'filter' => new QueueFilter('all'),
'queueFilter' => new QueueFilter('all'),
'expected' => 0,
];
yield 'Flush Pending entries' => [
'filter' => new QueueFilter('pending'),
'queueFilter' => new QueueFilter('pending'),
'expected' => 7,
];
yield 'Flush Finished entries' => [
'filter' => new QueueFilter('finished'),
'queueFilter' => new QueueFilter('finished'),
'expected' => 8,
];
}
Expand Down Expand Up @@ -357,43 +357,43 @@ public function getDuplicateQueueItemsIfExists(
public static function getDuplicateQueueItemsIfExistsDataProvider(): iterable
{
yield 'EnableTimeslot is true and timestamp is <= current' => [
'timeslotActive' => true,
'tstamp' => 10,
'current' => 12,
'page_id' => 10,
'parameters_hash' => '',
'enableTimeslot' => true,
'timestamp' => 10,
'currentTime' => 12,
'pageId' => 10,
'parametersHash' => '',
'expected' => [1018, 1020],
];
yield 'EnableTimeslot is false and timestamp is <= current' => [
'timeslotActive' => false,
'tstamp' => 11,
'current' => 11,
'page_id' => 10,
'parameters_hash' => '',
'enableTimeslot' => false,
'timestamp' => 11,
'currentTime' => 11,
'pageId' => 10,
'parametersHash' => '',
'expected' => [1018],
];
yield 'EnableTimeslot is true and timestamp is > current' => [
'timeslotActive' => true,
'tstamp' => 12,
'current' => 10,
'page_id' => 10,
'parameters_hash' => '',
'enableTimeslot' => true,
'timestamp' => 12,
'currentTime' => 10,
'pageId' => 10,
'parametersHash' => '',
'expected' => [1020],
];
yield 'EnableTimeslot is false and timestamp is > current' => [
'timeslotActive' => false,
'tstamp' => 12,
'current' => 10,
'page_id' => 10,
'parameters_hash' => '',
'enableTimeslot' => false,
'timestamp' => 12,
'currentTime' => 10,
'pageId' => 10,
'parametersHash' => '',
'expected' => [1020],
];
yield 'EnableTimeslot is false and timestamp is > current and parameters_hash is set' => [
'timeslotActive' => false,
'tstamp' => 12,
'current' => 10,
'page_id' => 10,
'parameters_hash' => 'NotReallyAHashButWillDoForTesting',
'enableTimeslot' => false,
'timestamp' => 12,
'currentTime' => 10,
'pageId' => 10,
'parametersHash' => 'NotReallyAHashButWillDoForTesting',
'expected' => [1019],
];
}
Expand Down
18 changes: 9 additions & 9 deletions Tests/Functional/Service/BackendModuleLogServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace AOE\Crawler\Tests\Unit\Service;
namespace AOE\Crawler\Tests\Functional\Service;

use AOE\Crawler\Service\BackendModuleLogService;
use AOE\Crawler\Tests\Functional\BackendRequestTestTrait;
Expand Down Expand Up @@ -110,7 +110,7 @@ public static function addRowsNoEntriesDataProvider(): \Iterator
'setId' => $setId,
'showResultLog' => '1',
'showFeVars' => '1',
'CVSExport' => false,
'CSVExport' => false,
'logEntries' => [],
'expected' => [[[
'titleRowSpan' => 1,
Expand All @@ -132,7 +132,7 @@ public static function addRowsDataProvider(): \Iterator
'setId' => $setId,
'showResultLog' => '1',
'showFeVars' => '1',
'CVSExport' => false,
'CSVExport' => false,
'logEntries' => [
[
'qid' => 20,
Expand Down Expand Up @@ -166,7 +166,7 @@ public static function addRowsDataProvider(): \Iterator
'setId' => $setId,
'showResultLog' => '1',
'showFeVars' => '1',
'CVSExport' => false,
'CSVExport' => false,
'logEntries' => [
[
'qid' => 20,
Expand Down Expand Up @@ -208,7 +208,7 @@ public static function addRowsDataProvider(): \Iterator
'setId' => $setId,
'showResultLog' => '0',
'showFeVars' => '0',
'CVSExport' => false,
'CSVExport' => false,
'logEntries' => [
[
'qid' => 20,
Expand Down Expand Up @@ -241,7 +241,7 @@ public static function addRowsDataProvider(): \Iterator
'setId' => $setId,
'showResultLog' => '0',
'showFeVars' => '0',
'CVSExport' => false,
'CSVExport' => false,
'logEntries' => [
[
'qid' => 20,
Expand Down Expand Up @@ -274,7 +274,7 @@ public static function addRowsDataProvider(): \Iterator
'setId' => $setId,
'showResultLog' => '0',
'showFeVars' => '0',
'CVSExport' => false,
'CSVExport' => false,
'logEntries' => [
[
'qid' => 20,
Expand Down Expand Up @@ -304,12 +304,12 @@ public static function addRowsDataProvider(): \Iterator
]], []],
];

yield 'One log entry, CVSExport is true' => [
yield 'One log entry, CSVExport is true' => [
'title' => $title,
'setId' => $setId,
'showResultLog' => '0',
'showFeVars' => '0',
'CVSExport' => true,
'CSVExport' => true,
'logEntries' => [
[
'qid' => 20,
Expand Down
8 changes: 4 additions & 4 deletions Tests/Unit/Controller/CrawlerControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static function getUrlsForPageRowDataProvider(): iterable
'pageRow' => [
'uid' => 2001,
],
'$skipMessage' => 'Just variable placeholder, not used in tests as parsed as reference',
'skipMessage' => 'Just variable placeholder, not used in tests as parsed as reference',
'expected' => ['index.php?q=search&page=1', 'index.php?q=search&page=2'],
];
yield 'Message string not empty, returns empty array' => [
Expand All @@ -168,7 +168,7 @@ public static function getUrlsForPageRowDataProvider(): iterable
'pageRow' => [
'uid' => 2001,
],
'$skipMessage' => 'Just variable placeholder, not used in tests as parsed as reference',
'skipMessage' => 'Just variable placeholder, not used in tests as parsed as reference',
'expected' => [],
];
yield 'PageRow Uid is string with int value' => [
Expand All @@ -177,7 +177,7 @@ public static function getUrlsForPageRowDataProvider(): iterable
'pageRow' => [
'uid' => '2001',
],
'$skipMessage' => 'Just variable placeholder, not used in tests as parsed as reference',
'skipMessage' => 'Just variable placeholder, not used in tests as parsed as reference',
'expected' => ['index.php?q=search&page=1', 'index.php?q=search&page=2'],
];
yield 'PageRow Uid is string with string value' => [
Expand All @@ -186,7 +186,7 @@ public static function getUrlsForPageRowDataProvider(): iterable
'pageRow' => [
'uid' => 'string',
],
'$skipMessage' => 'PageUid "string" was not an integer',
'skipMessage' => 'PageUid "string" was not an integer',
'expected' => [],
];
}
Expand Down
24 changes: 12 additions & 12 deletions Tests/Unit/Controller/Helper/ResultHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,29 +132,29 @@ public function getResultLog(array $resultLog, string $expected): void

public static function getResultLogDataProvider(): iterable
{
yield 'ResultRow key result_data does not exist' => [
'resultRow' => [
yield 'resultLog key result_data does not exist' => [
'resultLog' => [
'other-key' => 'value',
],
'expected' => '',
];
yield 'ResultRow key result_data does exist, but empty' => [
'resultRow' => [
yield 'resultLog key result_data does exist, but empty' => [
'resultLog' => [
'result_data' => '',
],
'expected' => '',
];
/* Bug We don't handle when result row doesn't contain content key */
yield 'ResultRow key result_data exits, is not empty, but does not contain content key' => [
'resultRow' => [
yield 'resultLog key result_data exits, is not empty, but does not contain content key' => [
'resultLog' => [
'result_data' => json_encode([
'not-content' => 'value',
], JSON_THROW_ON_ERROR),
],
'expected' => '',
];
yield 'ResultRow key result_data exits and is not empty, does not contain log' => [
'resultRow' => [
yield 'resultLog key result_data exits and is not empty, does not contain log' => [
'resultLog' => [
'result_data' => json_encode(
[
'content' => json_encode([
Expand All @@ -166,8 +166,8 @@ public static function getResultLogDataProvider(): iterable
],
'expected' => '',
];
yield 'ResultRow key result_data exits and is not empty, does contain log (1 element)' => [
'resultRow' => [
yield 'resultLog key result_data exits and is not empty, does contain log (1 element)' => [
'resultLog' => [
'result_data' => json_encode(
[
'content' => json_encode([
Expand All @@ -179,8 +179,8 @@ public static function getResultLogDataProvider(): iterable
],
'expected' => 'ok',
];
yield 'ResultRow key result_data exits and is not empty, does contain log (2 elements)' => [
'resultRow' => [
yield 'resultLog key result_data exits and is not empty, does contain log (2 elements)' => [
'resultLog' => [
'result_data' => json_encode(
[
'content' => json_encode([
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/Service/ConfigurationServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public static function removeDisallowedConfigurationsDataProvider(): iterable
{
yield 'both allowed and configuration is empty' => [
'allowed' => [],
'configurations' => [],
'configuration' => [],
'expected' => [],
];
yield 'allowed is empty' => [
'allowed' => [],
'configurations' => [
'configuration' => [
'default' => 'configuration-text',
'news' => 'configuration-text',
],
Expand All @@ -69,7 +69,7 @@ public static function removeDisallowedConfigurationsDataProvider(): iterable
];
yield 'news is not allowed' => [
'allowed' => ['default'],
'configurations' => [
'configuration' => [
'default' => 'configuration-text',
'news' => 'configuration-text',
],
Expand Down
16 changes: 8 additions & 8 deletions Tests/Unit/Service/PageServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
];

yield 'Page of doktype 3 - External Url' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 3,
'hidden' => 0,
Expand All @@ -117,7 +117,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
];

yield 'Page of doktype 4 - Shortcut' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 4,
'hidden' => 0,
Expand All @@ -128,7 +128,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
];

yield 'Page of doktype 155 - Custom' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 155,
'hidden' => 0,
Expand All @@ -141,7 +141,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
];

yield 'Page of doktype 199 - Spacer' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 199,
'hidden' => 0,
Expand All @@ -152,7 +152,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
];

yield 'Page of doktype 254 - Folder' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 254,
'hidden' => 0,
Expand All @@ -163,7 +163,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
];

yield 'Page of doktype 255 - Recycler' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 255,
'hidden' => 0,
Expand All @@ -177,7 +177,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
* Left out as we want people to use the PSR-14 ModifySkipPageEvent instead,
* kept for easy testing if needed.
yield 'Page veto exists' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 1,
'hidden' => 0,
Expand All @@ -188,7 +188,7 @@ public static function checkIfPageShouldBeSkippedDataProvider(): iterable
];
yield 'Page veto exists - string' => [
'extensionSettings' => [],
'extensionSetting' => [],
'pageRow' => [
'doktype' => 1,
'hidden' => 0,
Expand Down

0 comments on commit b2efa98

Please sign in to comment.