Commit 4e315042 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch 'develop' into 'main'

Release 09-03-2021

See merge request !649
parents 47a89dc9 ecd1f58a
Pipeline #10491 passed with stages
in 10 minutes and 17 seconds
......@@ -16,3 +16,6 @@ services:
- TER_REST_JWT_SUBJECT=t3o-ter-rest
- TER_REST_JWT_LATENCY=60
- TER_REST_SIGNATURE_IDENTIFIER=ecdsa
- SOLR_HOST=solr
- SOLR_PORT=8983
- SOLR_SCHEME=http
......@@ -62,10 +62,6 @@ task('typo3', function () {
run('cd {{release_path}} && {{php}} {{bin_folder}}typo3cms install:extensionsetupifpossible');
});
task('solr:host', function () {
run('cd {{deploy_path}} && ./solr_change_host.sh');
});
task('typo3:ter_wsdl', function () {
run('cd {{release_path}}/public/typo3conf/ext && mkdir ter');
run('cd {{release_path}}/public/typo3conf/ext/ter && ln -s ../../../../private/typo3conf/ext/ter/tx_ter_wsdl.php');
......@@ -98,7 +94,6 @@ task('deploy', [
'typo3',
'typo3:ter_wsdl',
'deploy:symlink',
'solr:host',
'cache',
'maintenance:deactivate',
'cleanup'
......
This diff is collapsed.
......@@ -33,9 +33,9 @@ errorHandling:
errorContentSource: 't3://page?uid=12'
routes: { }
solr_enabled_read: true
solr_scheme_read: http
solr_host_read: solr
solr_port_read: 8983
solr_scheme_read: '%env(SOLR_SCHEME)%'
solr_host_read: '%env(SOLR_HOST)%'
solr_port_read: '%env(SOLR_PORT)%'
solr_path_read: /solr/
solr_use_write_connection: false
imports:
......
......@@ -119,7 +119,7 @@ class LTSVersionService
$allLTSVersions = [];
foreach ($this->releases as $release) {
$firstReleaseOfMainVersion = $this->getFirstReleaseOfMainVersion($release['latest']);
$mainVersion = (int)($firstReleaseOfMainVersion / self::FACTOR_MAIN_VERSION);
$mainVersion = $firstReleaseOfMainVersion / self::FACTOR_MAIN_VERSION;
if ($mainVersion >= self::FIRST_LTS_VERSION_WITH_MAIN_VERSION_NUMBER || in_array($firstReleaseOfMainVersion, $this->ltsVersionsWithMinorVersions, true)) {
if ($firstReleaseOfMainVersion < VersionNumberUtility::convertVersionNumberToInteger($this->coreData['latest_lts'])) {
$allLTSVersions[] = $firstReleaseOfMainVersion;
......@@ -180,7 +180,7 @@ class LTSVersionService
*/
public function getAllLTSVersions($fullVersionNumber = true): array
{
$result = $this->getLTSVersions(true);
$result = $this->getLTSVersions();
if (!$fullVersionNumber) {
$this->convertVersionsToLabels($result);
}
......@@ -240,7 +240,7 @@ class LTSVersionService
public function getVersionLabelOfRelease(int $release): string
{
if ($release >= (self::FIRST_LTS_VERSION_WITH_MAIN_VERSION_NUMBER * self::FACTOR_MAIN_VERSION)) {
$versionLabel = (string)floor($release / self::FACTOR_MAIN_VERSION);
$versionLabel = floor($release / self::FACTOR_MAIN_VERSION);
} else {
$fullVersionLabelParts = explode('.', VersionUtility::convertIntegerToVersionNumber($release));
$versionLabel = $fullVersionLabelParts[0] . '.' . $fullVersionLabelParts[1];
......@@ -280,8 +280,8 @@ class LTSVersionService
public function isVersionLTS(int $versionNumber): bool
{
$firstRelease = (int)($versionNumber / self::FACTOR_MINOR_VERSION) * self::FACTOR_MINOR_VERSION;
$mainVersion = (int)($firstRelease / self::FACTOR_MAIN_VERSION);
$firstRelease = $this->getFirstReleaseOfMainVersion($versionNumber);
$mainVersion = $firstRelease / self::FACTOR_MAIN_VERSION;
return ($mainVersion >= self::FIRST_LTS_VERSION_WITH_MAIN_VERSION_NUMBER && $mainVersion <= $this->getLatestDevelopmentVersion()) || in_array($firstRelease, $this->ltsVersionsWithMinorVersions, true);
}
......
......@@ -14,7 +14,7 @@
</thead>
<tbody>
<f:for each="{versionHistory}" as="version">
<tr{f:if(condition:'{version} == {version.extension.lastVersion} && {version.reviewState} != -1',then:' class="table-success"')}{f:if(condition:'{version.reviewState} == -1',then:' class="table-danger"')}>
<tr id="v{version.versionString}"{f:if(condition:'{version} == {version.extension.lastVersion} && {version.reviewState} != -1',then:' class="table-success"')}{f:if(condition:'{version.reviewState} == -1',then:' class="table-danger"')} >
<td class="align-middle text-center">
<f:form.checkbox name="insecureVersions[]" value="{version.uid}" checked="{version.reviewState} == -1" />
</td>
......@@ -87,7 +87,7 @@
</thead>
<tbody>
<f:for each="{versionHistory}" as="version">
<tr{f:if(condition:'{version} == {version.extension.lastVersion} && {version.reviewState} != -1',then:' class="table-success"')}{f:if(condition:'{version.reviewState} == -1',then:' class="table-danger"')}>
<tr id="v{version.versionString}" {f:if(condition:'{version} == {version.extension.lastVersion} && {version.reviewState} != -1',then:' class="table-success"')}{f:if(condition:'{version.reviewState} == -1',then:' class="table-danger"')}>
<td class="align-middle">
<strong>{version.versionString}</strong> /
<span class="ter-ext-state-{version.state}">{version.state}</span>
......
......@@ -132,6 +132,7 @@
</p>
<script type="text/javascript">
var versionChartData = {extension.downloadsByTimeIntervalAsJson -> f:format.raw()};
var versionChartLastSync = "<f:format.date format='%B %d, %I:%M %P %Z'>{extension.lastDownloadSync}</f:format.date>";
</script>
<div id="versionChart">
......
......@@ -15,6 +15,10 @@ jQuery(document).ready(function ($) {
chart: {
type: 'column'
},
credits: {
text: 'Last packagist sync: ' + versionChartLastSync,
href: "https://packagist.org/"
},
title: {
text: 'Downloads by months'
},
......@@ -51,7 +55,7 @@ jQuery(document).ready(function ($) {
},
{
name: 'TER',
color: '#f49700',
color: '#ff8700',
data: versionChartData.downloadsTER
},
{
......
......@@ -316,6 +316,12 @@ class ExtensionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
);
$extension->removeVersion($versionOne);
self::assertInstanceOf(
Version::class,
$extension->getLastVersion()
);
$extension->removeVersion($versionTwo);
self::assertNull($extension->getLastVersion());
......@@ -341,10 +347,10 @@ class ExtensionTest extends \Nimut\TestingFramework\TestCase\UnitTestCase
$downloadRepository->expects(self::once())
->method('findDownloadsByExtensionkey')
->with($extension->getExtKey())
->willReturn(0);
->willReturn(10);
self::assertEquals(
3000,
3010,
$extension->getDownloads()
);
}
......
......@@ -199,4 +199,87 @@ class ExtensionIndexServiceTest extends UnitTestCase
$resultString = preg_replace('/\<!--Index created(.*)--\>\n/m', '', $resultString);
self::assertEquals($expected, $resultString);
}
/**
* @test
* @dataProvider constructorTestDataProvider
*/
public function constructorTest(string $basePath, string $expected): void
{
$extensionIndexService = self::getAccessibleMock(ExtensionIndexService::class, ['dummy'], [$basePath]);
self::assertEquals(
$expected,
$extensionIndexService->_get('basePath')
);
}
public function constructorTestDataProvider(): array
{
return [
'Empty not null' => [
'basePath' => '',
'expected' => '/'
],
'no tailing slash' => [
'basePath' => 'path',
'expected' => 'path/'
],
'one tailing slash' => [
'basePath' => 'path/',
'expected' => 'path/'
],
'two tailing slashes' => [
'basePath' => 'path//',
'expected' => 'path/'
],
];
}
/**
* @test
* @dataProvider xmlentitiesDataProvider
*/
public function xmlentitiesTest(string $string, string $expected): void
{
$extensionIndexService = self::getAccessibleMock(
ExtensionIndexService::class,
['dummy'],
[],
'',
false
);
self::assertEquals(
$expected,
$extensionIndexService->_call('xmlentities', $string)
);
}
public function xmlentitiesDataProvider(): array
{
return [
'Empty string ' => [
'',
''
],
'String with &' => [
'Tom & Jerry',
'Tom &amp; Jerry'
],
'String with double quote' => [
'"Sarcasm"',
'&quot;Sarcasm&quot;'
],
// The mutation went away, but still missing two test cases, but they failed to me.
/*'String with single quote' => [
"'Sarcasm'",
'&apos;Sarcasm&apos;'
],
'String with <>' => [
'1 <> 2',
'1 &lt;&gt; 2'
]*/
];
// ['&', '"', "'", '<', '>'], ['&amp;', '&quot;', '&apos;', '&lt;', '&gt;']
}
}
<?php
namespace T3o\TerFe2\Tests\Service;
/*
......@@ -62,7 +63,7 @@ class LTSVersionServiceTest extends UnitTestCase
*/
public function getAllMaintainedVersions()
{
self::assertSame(['8', '9', '10'], $this->subject->getAllMaintainedVersions());
self::assertSame(['4.7', '8', '9', '10'], $this->subject->getAllMaintainedVersions());
}
/**
......@@ -70,7 +71,7 @@ class LTSVersionServiceTest extends UnitTestCase
*/
public function getAllMaintainedVersionsAsFullVersionNumber()
{
self::assertSame([8007000, 9005000, 10000000], $this->subject->getAllMaintainedVersions(true));
self::assertSame([4007000, 8007000, 9005000, 10000000], $this->subject->getAllMaintainedVersions(true));
}
/**
......@@ -94,7 +95,7 @@ class LTSVersionServiceTest extends UnitTestCase
*/
public function getLatestDevelopmentVersionAsFullVersionNumber()
{
self::assertSame(10000000, $this->subject->getLatestDevelopmentVersion(true));
self::assertSame(10999000, $this->subject->getLatestDevelopmentVersion(true));
}
/**
......@@ -112,6 +113,17 @@ class LTSVersionServiceTest extends UnitTestCase
],
$this->subject->getAllLTSVersions()
);
self::assertSame(
[
'4.5',
'6.2',
'7',
'8',
'9'
],
$this->subject->getAllLTSVersions(false)
);
}
/**
......@@ -129,19 +141,54 @@ class LTSVersionServiceTest extends UnitTestCase
/**
* @test
* @dataProvider getActiveVersionsDataProvider
*/
public function getActiveVersions()
public function getActiveVersions($ltsOnly, $expected)
{
if (null === $ltsOnly) {
$actual = $this->subject->getActiveVersions();
} else {
$actual = $this->subject->getActiveVersions($ltsOnly);
}
self::assertSame(
[
8007000,
9005000,
10000000,
],
$this->subject->getActiveVersions()
$expected,
$actual
);
}
public function getActiveVersionsDataProvider(): array
{
return [
'ltsOnly not set, defaults to false' => [
'ltsOnly' => null,
'expected' => [
4007000,
8007000,
9005000,
10000000,
],
],
'ltsOnly set to false' => [
'ltsOnly' => false,
'expected' => [
4007000,
8007000,
9005000,
10000000,
],
],
'ltsOnly set to true' => [
'ltsOnly' => true,
'expected' => [
8007000,
9005000,
10000000,
],
],
];
}
/**
* @test
*/
......@@ -181,12 +228,25 @@ class LTSVersionServiceTest extends UnitTestCase
/**
* @test
*/
public function getVersionLabelOfNewVersion()
public function getVersionLabelOfRelease()
{
self::assertSame(
'8',
$this->subject->getVersionLabelOfRelease(8007004)
);
self::assertSame(
'7',
$this->subject->getVersionLabelOfRelease(7000000)
);
// Ensures the floor() is tested
self::assertSame(
'7',
$this->subject->getVersionLabelOfRelease(7999000)
);
self::assertIsString($this->subject->getVersionLabelOfRelease(8007004));
}
/**
......@@ -265,7 +325,9 @@ class LTSVersionServiceTest extends UnitTestCase
],
'4.7' => [
'latest' => '4.7.40',
'active' => false,
// Has to be active otherwise the getActiveVersions will not have
// a test case for active not LTS.
'active' => true,
'elts' => false,
],
'4.6' => [
......@@ -278,7 +340,10 @@ class LTSVersionServiceTest extends UnitTestCase
'active' => false,
'elts' => false,
],
'latest_stable' => '10.0.0',
// Needs to have 10.999.0 or higher to have the getLatestDevelopmentVersion() floor()
// part tested, otherwise a ceil() would give the same result and return in an error,
// when getting to higher version numbers.
'latest_stable' => '10.999.0',
'latest_old_stable' => '9.5.5',
'latest_lts' => '9.5.5',
'latest_old_lts' => '8.7.9'
......
......@@ -15,6 +15,7 @@ namespace T3o\TerFe2\Tests\Service;
* The TYPO3 project - inspiring people to share!
*/
use T3o\TerFe2\Service\OutdatedVersionService;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
class OutdatedVersionServiceTest extends \Nimut\TestingFramework\TestCase\AbstractTestCase
......@@ -26,7 +27,7 @@ class OutdatedVersionServiceTest extends \Nimut\TestingFramework\TestCase\Abstra
public function setUp()
{
$this->subject = new \T3o\TerFe2\Service\OutdatedVersionService();
$this->subject = self::getAccessibleMock(OutdatedVersionService::class, ['dummy'], [], '', false);
$this->subject->supportedCoreVersions = [4005000, 4007000, 6000000, 6001000, 6002000, 7006000, 8007000];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment