Skip to content

Commit

Permalink
[TASK] Update nimut/testing-framework to 3.x
Browse files Browse the repository at this point in the history
This pr:

* Updates the testing framework to 3.x
* Fixes issues in the tests that are related to the update

Fixes: TYPO3-Solr#1823
  • Loading branch information
timohund committed Jan 31, 2018
1 parent 97e960c commit 66937a7
Show file tree
Hide file tree
Showing 19 changed files with 255 additions and 27 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
php:
- 7.0
- 7.1
- 7.2

jdk:
- oraclejdk8
Expand All @@ -26,15 +27,15 @@ env:
matrix:
- TYPO3_VERSION="^8.7"
- TYPO3_VERSION="8.x-dev"
- TYPO3_VERSION="9.x-dev as 8.7.99"
- TYPO3_VERSION="^9.1"

matrix:
fast_finish: true
allow_failures:
- env: TYPO3_VERSION="9.x-dev as 8.7.99"
php: 7.0
- env: TYPO3_VERSION="9.x-dev as 8.7.99"
php: 7.1
exclude:
- php: 7.0
env: TYPO3_VERSION="^9.1"
- php: 7.1
env: TYPO3_VERSION="^9.1"

before_install:
- composer self-update
Expand Down
15 changes: 14 additions & 1 deletion Build/Test/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@ echo "Using package path $TYPO3_PATH_PACKAGES"
echo "Using web path $TYPO3_PATH_WEB"

# Install TYPO3 sources
composer require --dev typo3/cms="$TYPO3_VERSION"
if [[ $TYPO3_VERSION = *"9."* ]]; then
composer require --dev typo3/cms-backend="$TYPO3_VERSION"
composer require --dev typo3/cms-core="$TYPO3_VERSION"
composer require --dev typo3/cms-fluid="$TYPO3_VERSION"
composer require --dev typo3/cms-frontend="$TYPO3_VERSION"
composer require --dev typo3/cms-lang="$TYPO3_VERSION"
composer require --dev typo3/cms-extbase="$TYPO3_VERSION"
composer require --dev typo3/cms-extbase="$TYPO3_VERSION"
composer require --dev typo3/cms-reports="$TYPO3_VERSION"
composer require --dev typo3/cms-scheduler="$TYPO3_VERSION"
composer require --dev typo3/cms-tstemplate="$TYPO3_VERSION"
else
composer require --dev typo3/cms="$TYPO3_VERSION"
fi

# Restore composer.json
git checkout composer.json
Expand Down
4 changes: 2 additions & 2 deletions Classes/Domain/Search/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ public function useFiltersFromTypoScript(): QueryBuilder

$searchQueryFilters = $this->typoScriptConfiguration->getSearchQueryFilterConfiguration();

if (count($searchQueryFilters) <= 0) {
if (!is_array($searchQueryFilters) || count($searchQueryFilters) <= 0) {
return $this;
}

Expand Down Expand Up @@ -844,7 +844,7 @@ public function getAdditionalFilters() : array
}

$searchQueryFilters = $this->typoScriptConfiguration->getSearchQueryFilterConfiguration();
if (count($searchQueryFilters) <= 0) {
if (!is_array($searchQueryFilters) || count($searchQueryFilters) <= 0) {
return [];
}

Expand Down
52 changes: 46 additions & 6 deletions Classes/System/Records/SystemDomain/SystemDomainRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
***************************************************************/

use ApacheSolrForTypo3\Solr\System\Records\AbstractRepository;
use ApacheSolrForTypo3\Solr\Util;

class SystemDomainRepository extends AbstractRepository
{
Expand All @@ -41,9 +42,34 @@ class SystemDomainRepository extends AbstractRepository
* @return mixed
*/
public function findDomainRecordsByRootPagesIds(array $rootPageIds = [])
{

if (Util::getIsTYPO3VersionBelow9()) {
//@todo this can be dropped when support of TYPO3 8 is dropped
$resultTmp = $this->getDomainRecordsByRootPageIdsFor8($rootPageIds);
} else {
$resultTmp = $this->getDomainRecordsByRootPageIdsFor9($rootPageIds);
}

$result = [];
foreach ($resultTmp as $key => $row) {
$result[$row['pid']] = $row;
}
return $result;
}

/**
* Fetches the domain records for TYPO3 8.
*
* @todo this can be dropped when support of TYPO3 8 is dropped
* @param array $rootPageIds
* @return array
*/
protected function getDomainRecordsByRootPageIdsFor8(array $rootPageIds = [])
{
$queryBuilder = $this->getQueryBuilder();
$resultTmp = $queryBuilder->select('uid', 'pid')

return $queryBuilder->select('uid', 'pid')
->from($this->table)
->where(
$queryBuilder->expr()->in('pid', $rootPageIds),
Expand All @@ -52,11 +78,25 @@ public function findDomainRecordsByRootPagesIds(array $rootPageIds = [])
->orderBy('pid')
->addOrderBy('sorting')
->execute()->fetchAll();
}

$result = [];
foreach ($resultTmp as $key => $row) {
$result[$row['pid']] = $row;
}
return $result;
/**
* Fetches the domain records for TYPO3 9.
*
* @param array $rootPageIds
* @return array
*/
protected function getDomainRecordsByRootPageIdsFor9(array $rootPageIds = [])
{
$queryBuilder = $this->getQueryBuilder();

return $queryBuilder->select('uid', 'pid')
->from($this->table)
->where(
$queryBuilder->expr()->in('pid', $rootPageIds)
)->groupBy('uid', 'pid', 'sorting')
->orderBy('pid')
->addOrderBy('sorting')
->execute()->fetchAll();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FrequentlySearchedViewHelper extends AbstractWidgetViewHelper

/**
* @var \ApacheSolrForTypo3\Solr\ViewHelpers\Widget\Controller\FrequentlySearchedController
* @inject
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $controller;

Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Widget/GroupItemPaginateViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GroupItemPaginateViewHelper extends AbstractWidgetViewHelper

/**
* @var \ApacheSolrForTypo3\Solr\ViewHelpers\Widget\Controller\GroupItemPaginateController
* @inject
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $controller;

Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Widget/LastSearchesViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class LastSearchesViewHelper extends AbstractWidgetViewHelper

/**
* @var \ApacheSolrForTypo3\Solr\ViewHelpers\Widget\Controller\LastSearchesController
* @inject
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $controller;

Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/Widget/ResultPaginateViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ResultPaginateViewHelper extends AbstractWidgetViewHelper

/**
* @var \ApacheSolrForTypo3\Solr\ViewHelpers\Widget\Controller\ResultPaginateController
* @inject
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $controller;

Expand Down
2 changes: 1 addition & 1 deletion Classes/Widget/AbstractWidgetViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ abstract class AbstractWidgetViewHelper extends AbstractCoreWidgetViewHelper imp

/**
* @var \TYPO3\CMS\Extbase\Service\ExtensionService
* @inject
* @TYPO3\CMS\Extbase\Annotation\Inject
*/
protected $extensionService;

Expand Down
1 change: 1 addition & 0 deletions Tests/Integration/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ protected function getConfiguredTSFE($TYPO3_CONF_VARS = [], $id = 1, $type = 0,
/** @var $TSFE \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */
$TSFE = GeneralUtility::makeInstance(TypoScriptFrontendController::class,
$TYPO3_CONF_VARS, $id, $type, $no_cache, $cHash, $_2, $MP, $RDCT);
$GLOBALS['TSFE'] = $TSFE;


EidUtility::initLanguage();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>

<sys_registry>
<uid>4711</uid>
<entry_namespace>tx_solr</entry_namespace>
<entry_key>servers</entry_key>
<entry_value>a:1:{s:3:"1|0";a:9:{s:13:"connectionKey";s:3:"1|0";s:13:"rootPageTitle";s:15:"Congratulations";s:11:"rootPageUid";s:1:"1";s:10:"solrScheme";s:4:"http";s:8:"solrHost";s:9:"localhost";s:8:"solrPort";s:4:"8999";s:8:"solrPath";s:14:"/solr/core_en/";s:8:"language";i:0;s:5:"label";s:74:"Congratulations (pid: 1, language: default) - localhost:8999/solr/core_en/";}}</entry_value>
</sys_registry>

<sys_template>
<uid>1</uid>
<pid>1</pid>
<root>1</root>
<clear>3</clear>
<config>
<![CDATA[
page = PAGE
page.typeNum = 0
page.bodyTag = <body>
config.index_enable = 0
plugin.tx_solr {
enabled = 1
solr {
scheme = http
host = localhost
port = 8999
path = /solr/core_en/
}
}
]]>
</config>
<sorting>100</sorting>
</sys_template>
<pages>
<uid>1</uid>
<is_siteroot>1</is_siteroot>
<doktype>1</doktype>
<title>Hello Search Test</title>
</pages>
<sys_domain>
<uid>1</uid>
<pid>1</pid>
<domainName>localhost</domainName>
<hidden>0</hidden>
<sorting>100</sorting>
</sys_domain>
</dataset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>

<sys_registry>
<uid>4711</uid>
<entry_namespace>tx_solr</entry_namespace>
<entry_key>servers</entry_key>
<entry_value>a:1:{s:3:"1|0";a:9:{s:13:"connectionKey";s:3:"1|0";s:13:"rootPageTitle";s:15:"Congratulations";s:11:"rootPageUid";s:1:"1";s:10:"solrScheme";s:4:"http";s:8:"solrHost";s:9:"localhost";s:8:"solrPort";s:4:"8999";s:8:"solrPath";s:14:"/solr/core_en/";s:8:"language";i:0;s:5:"label";s:74:"Congratulations (pid: 1, language: default) - localhost:8999/solr/core_en/";}}</entry_value>
</sys_registry>

<sys_template>
<uid>1</uid>
<pid>1</pid>
<root>1</root>
<clear>3</clear>
<config>
<![CDATA[
page = PAGE
page.typeNum = 0
page.bodyTag = <body>
config.index_enable = 1
plugin.tx_solr {
enabled = 1
solr {
scheme = http
host = localhost
port = 8999
path = /solr/core_en/
}
}
]]>
</config>
<sorting>100</sorting>
</sys_template>
<sys_domain>
<uid>1</uid>
<pid>1</pid>
<domainName>localhost</domainName>
<hidden>0</hidden>
<sorting>100</sorting>
</sys_domain>
</dataset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>

<sys_registry>
<uid>4711</uid>
<entry_namespace>tx_solr</entry_namespace>
<entry_key>servers</entry_key>
<entry_value>a:1:{s:3:"1|0";a:9:{s:13:"connectionKey";s:3:"1|0";s:13:"rootPageTitle";s:15:"Congratulations";s:11:"rootPageUid";s:1:"1";s:10:"solrScheme";s:4:"http";s:8:"solrHost";s:9:"localhost";s:8:"solrPort";s:4:"8999";s:8:"solrPath";s:14:"/solr/core_en/";s:8:"language";i:0;s:5:"label";s:74:"Congratulations (pid: 1, language: default) - localhost:8999/solr/core_en/";}}</entry_value>
</sys_registry>

<sys_template>
<uid>1</uid>
<pid>1</pid>
<root>1</root>
<clear>3</clear>
<config>
<![CDATA[
page = PAGE
page.typeNum = 0
page.bodyTag = <body>
config.index_enable = 1
plugin.tx_solr {
enabled = 1
solr {
scheme = http
host = localhost
port = 8999
path = /solr/core_en/
}
}
]]>
</config>
<sorting>100</sorting>
</sys_template>
<pages>
<uid>1</uid>
<is_siteroot>1</is_siteroot>
<doktype>1</doktype>
<title>Hello Search Test</title>
</pages>
<sys_domain>
<uid>1</uid>
<pid>1</pid>
<domainName>localhost</domainName>
<hidden>0</hidden>
<sorting>100</sorting>
</sys_domain>
</dataset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<sys_domain>
<uid>17</uid>
<pid>24</pid>
<domainName>localhost</domainName>
<hidden>0</hidden>
<sorting>100</sorting>
</sys_domain>
</dataset>
Loading

0 comments on commit 66937a7

Please sign in to comment.