Skip to content

Commit

Permalink
[FIX] tests for TYPO3 13 @ 2024.07.02
Browse files Browse the repository at this point in the history
Migrates:
* Configuration/FlexForms/Form.xml
* Configuration/FlexForms/Results.xml

Relates: TYPO3-Solr#3995
  • Loading branch information
dkd-kaehm committed Jul 3, 2024
1 parent 816746d commit b808a64
Show file tree
Hide file tree
Showing 53 changed files with 498 additions and 602 deletions.
5 changes: 2 additions & 3 deletions Build/Test/IntegrationTests.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="true"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="../../.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
Expand All @@ -15,10 +15,9 @@
failOnNotice="true"
failOnRisky="true"
failOnWarning="true"
requireCoverageMetadata="false"
processIsolation="true"
>
<coverage includeUncoveredFiles="false"></coverage>
<coverage includeUncoveredFiles="false"/>
<source>
<include>
<directory>../../Classes</directory>
Expand Down
23 changes: 19 additions & 4 deletions Classes/Domain/Index/Queue/UpdateHandler/DataUpdateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function handleMovedPage(int $uid, ?int $previousParentId = null): void
$this->applyPageChangesToQueue($uid);

if ($previousParentId !== null) {
$pageRecord = BackendUtility::getRecord('pages', $uid);
$pageRecord = $this->getRecord('pages', $uid);
if ($pageRecord !== null && (int)$pageRecord['pid'] !== $previousParentId) {
$treePageIds = $this->getSubPageIds($uid);
$this->updatePageIdItems($treePageIds);
Expand Down Expand Up @@ -386,8 +386,8 @@ protected function processPageRecord(int $uid, int $pid, array $updatedFields =
$this->mountPageUpdater->update($uid);

// We need to get the full record to find out if this is a page translation
$fullRecord = BackendUtility::getRecord('pages', $uid);
if ($fullRecord['sys_language_uid'] > 0) {
$fullRecord = $this->getRecord('pages', $uid);
if (($fullRecord['sys_language_uid'] ?? null) > 0) {
$uid = (int)$fullRecord['l10n_parent'];
}

Expand Down Expand Up @@ -491,7 +491,7 @@ protected function getConfigurationPageId(string $recordTable, int $recordPageId
*/
protected function getIsTranslationParentRecordEnabled(string $recordTable, int $recordUid): bool
{
$l10nParentRecord = (array)BackendUtility::getRecord($recordTable, $recordUid, '*', '', false);
$l10nParentRecord = (array)$this->getRecord($recordTable, $recordUid, '*', '', false);
return $this->tcaService->isEnabledRecord($recordTable, $l10nParentRecord);
}

Expand Down Expand Up @@ -548,4 +548,19 @@ protected function getSiteRepository(): SiteRepository
{
return GeneralUtility::makeInstance(SiteRepository::class);
}

/**
* Wraps {@link BackendUtility::getRecord()}
*
* Purpose: Unit-Tests
*/
protected function getRecord(
string $table,
int|string $uid,
string $fields = '*',
string $where = '',
bool $useDeleteClause = true,
): ?array {
return BackendUtility::getRecord($table, $uid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use ApacheSolrForTypo3\Solr\IndexQueue\Item;
use ApacheSolrForTypo3\Solr\System\Configuration\TypoScriptConfiguration;
use ApacheSolrForTypo3\Solr\System\Solr\Document\Document;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Frontend\ContentObject\Exception\ContentRenderingException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,10 @@

namespace ApacheSolrForTypo3\Solr\Event\Indexing;

use ApacheSolrForTypo3\Solr\IndexQueue\Item;
use ApacheSolrForTypo3\Solr\System\Solr\Document\Document;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

/**
* Allows to add more documents to the Solr index.
*
* Previously used with
* $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPageAddDocuments']
*/
class BeforePageDocumentIsProcessedForIndexingEvent extends BeforeDocumentIsProcessedForIndexingEvent
{
}
class BeforePageDocumentIsProcessedForIndexingEvent extends BeforeDocumentIsProcessedForIndexingEvent {}
1 change: 0 additions & 1 deletion Classes/IndexQueue/AbstractIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use ApacheSolrForTypo3\Solr\System\Util\ArrayAccessor;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\TypoScript\FrontendTypoScript;
use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
Expand Down
10 changes: 5 additions & 5 deletions Classes/System/Solr/Service/AbstractSolrService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
abstract class AbstractSolrService
{
protected static array $pingCache = [];

protected TypoScriptConfiguration $configuration;

protected SolrLogManager $logger;

protected Client $client;

public function __construct(Client $client, $typoScriptConfiguration = null, $logManager = null)
{
public function __construct(
Client $client,
TypoScriptConfiguration $typoScriptConfiguration = null,
SolrLogManager $logManager = null,
) {
$this->client = $client;
$this->configuration = $typoScriptConfiguration ?? Util::getSolrConfiguration();
$this->logger = $logManager ?? GeneralUtility::makeInstance(SolrLogManager::class, __CLASS__);
Expand Down
101 changes: 45 additions & 56 deletions Configuration/FlexForms/Form.xml
Original file line number Diff line number Diff line change
@@ -1,59 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>Search</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<search.targetPage>
<TCEforms>
<label>Target Page</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
</config>
</TCEforms>
</search.targetPage>
</el>
</ROOT>
</sDEF>
<sOptions>
<ROOT>
<TCEforms>
<sheetTitle>Options</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<view.templateFiles.form>
<TCEforms>
<label>Custom Template</label>
<config>
<section>1</section>
<type>select</type>
<renderType>selectSingle</renderType>
<itemsProcFunc>ApacheSolrForTypo3\Solr\System\UserFunctions\FlexFormUserFunctions->getAvailableTemplates</itemsProcFunc>
</config>
</TCEforms>
</view.templateFiles.form>
<view.pluginNamespace>
<TCEforms>
<exclude>1</exclude>
<label>Plugin Namespace</label>
<config>
<section>1</section>
<type>select</type>
<renderType>selectSingle</renderType>
<itemsProcFunc>ApacheSolrForTypo3\Solr\System\UserFunctions\FlexFormUserFunctions->getAvailablePluginNamespaces</itemsProcFunc>
<default>tx_solr</default>
</config>
</TCEforms>
</view.pluginNamespace>
</el>
</ROOT>
</sOptions>
</sheets>
<sheets>
<sDEF>
<ROOT>
<sheetTitle>Search</sheetTitle>
<type>array</type>
<el>
<search.targetPage>
<label>Target Page</label>
<config>
<type>group</type>
<allowed>pages</allowed>
</config>
</search.targetPage>
</el>
</ROOT>
</sDEF>
<sOptions>
<ROOT>
<sheetTitle>Options</sheetTitle>
<type>array</type>
<el>
<view.templateFiles.form>
<label>Custom Template</label>
<config>
<section>1</section>
<type>select</type>
<renderType>selectSingle</renderType>
<itemsProcFunc>ApacheSolrForTypo3\Solr\System\UserFunctions\FlexFormUserFunctions->getAvailableTemplates</itemsProcFunc>
</config>
</view.templateFiles.form>
<view.pluginNamespace>
<exclude>1</exclude>
<label>Plugin Namespace</label>
<config>
<section>1</section>
<type>select</type>
<renderType>selectSingle</renderType>
<itemsProcFunc>ApacheSolrForTypo3\Solr\System\UserFunctions\FlexFormUserFunctions->getAvailablePluginNamespaces</itemsProcFunc>
<default>tx_solr</default>
</config>
</view.pluginNamespace>
</el>
</ROOT>
</sOptions>
</sheets>
</T3DataStructure>
Loading

0 comments on commit b808a64

Please sign in to comment.