Skip to content

Commit

Permalink
Merge branch 'main' into use-typo3-yamlfileloader
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Dec 6, 2024
2 parents acc3183 + 14ea15d commit 123bfab
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 46 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,9 @@ jobs:
- name: Run rector
run: |
make rector-check
# - name: Run unit tests
# run: |
# XDEBUG_MODE=coverage .Build/bin/phpunit -c Tests/phpunit.xml.dist --log-junit .Build/logs/phpunit.xml --coverage-text --coverage-clover .Build/logs/clover.xml
# - name: Send code coverage report to coveralls.io
# run: .Build/bin/php-coveralls -v
# env:
# COVERALLS_RUN_LOCALLY: 1
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
- name: Run tests and collect coverage
run: .Build/bin/phpunit --configuration Tests/phpunit.xml.dist --coverage-clover coverage.xml .
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
File renamed without changes.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.2] - 2024-12-02

### Fixed
- Using configuration from EXT:matomo_integration with relative URLs throws error

## [3.1.1] - 2024-09-23

### Fixed
Expand Down Expand Up @@ -200,7 +205,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Initial release


[Unreleased]: https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.1...HEAD
[Unreleased]: https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.2...HEAD
[3.1.2]: https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.1...v3.1.2
[3.1.1]: https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.0...v3.1.1
[3.1.0]: https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.0.0...v3.1.0
[3.0.0]: https://github.com/brotkrueml/typo3-matomo-widgets/compare/v2.4.0...v3.0.0
Expand Down
4 changes: 4 additions & 0 deletions Classes/Configuration/ConfigurationFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public static function buildConfigurations(string $configPath, bool $isMatomoInt
$url = $siteConfiguration['matomoWidgetsUrl'] ?? '';
$idSite = (int) ($siteConfiguration['matomoWidgetsIdSite'] ?? 0);
}
if (\str_starts_with($url, '//')) {
// We have a relative URL: prepend the scheme from the base URL of the site configuration
$url = \parse_url((string) $siteConfiguration['base'], \PHP_URL_SCHEME) . ':' . $url;
}
if ($url === '') {
continue;
}
Expand Down
11 changes: 10 additions & 1 deletion Documentation/Changelog/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_\ ,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.

`Unreleased <https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.1...HEAD>`_
`Unreleased <https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.2...HEAD>`_
--------------------------------------------------------------------------------------------

`3.1.2 <https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.1...v3.1.2>`_ - 2024-12-02
------------------------------------------------------------------------------------------------------

Fixed
^^^^^


* Using configuration from EXT:matomo_integration with relative URLs throws error

`3.1.1 <https://github.com/brotkrueml/typo3-matomo-widgets/compare/v3.1.0...v3.1.1>`_ - 2024-09-23
------------------------------------------------------------------------------------------------------

Expand Down
8 changes: 3 additions & 5 deletions Documentation/Installation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ Installation
Target group: **Administrators**

.. note::
The extension in version |version| supports TYPO3 v12 LTS and TYPO3 v13.
Use an older version for compatibility with TYPO3 v10 LTS or TYPO3 v11 LTS.
The extension in version |version| supports TYPO3 v12 LTS and TYPO3 v13 LTS.

The recommended way to install this extension is by using Composer. In your
Composer-based TYPO3 project root, just type:
Expand All @@ -21,9 +20,8 @@ Composer-based TYPO3 project root, just type:
and the recent version will be installed.

You can also install the extension from the `TYPO3 Extension Repository (TER)`_.
See :ref:`t3start:extensions_legacy_management` for a manual how to
install an extension.
In a legacy installation you can also install the extension from the
`TYPO3 Extension Repository (TER)`_.

The extension offers some configuration which is explained in the
:ref:`Configuration <Configuration>` chapter.
Expand Down
4 changes: 2 additions & 2 deletions Documentation/guides.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
/>
<project
title="Matomo Widgets"
release="3.1.1"
version="3.1"
release="3.2.0-dev"
version="3.2"
copyright="since 2020 by Chris Müller"
/>
<inventory
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# TYPO3 Matomo Widgets

[![CI Status](https://github.com/brotkrueml/typo3-matomo-widgets/workflows/CI/badge.svg?branch=main)](https://github.com/brotkrueml/typo3-matomo-widgets/actions?query=workflow%3ACI)
<!--
[![Coverage Status](https://coveralls.io/repos/github/brotkrueml/typo3-matomo-widgets/badge.svg?branch=main)](https://coveralls.io/github/brotkrueml/typo3-matomo-widgets?branch=main)
-->
[![CI](https://github.com/brotkrueml/typo3-matomo-widgets/actions/workflows/ci.yml/badge.svg)](https://github.com/brotkrueml/typo3-matomo-widgets/actions/workflows/ci.yml)
[![Documentation](https://github.com/brotkrueml/typo3-matomo-widgets/actions/workflows/docs.yml/badge.svg)](https://github.com/brotkrueml/typo3-matomo-widgets/actions/workflows/docs.yml)
[![codecov](https://codecov.io/github/brotkrueml/typo3-matomo-widgets/graph/badge.svg?token=2ECAIAYXMS)](https://codecov.io/github/brotkrueml/typo3-matomo-widgets)
[![Crowdin](https://badges.crowdin.net/typo3-extension-matomowidgets/localized.svg)](https://crowdin.com/project/typo3-extension-matomowidgets)
[![Latest Stable Version](https://img.shields.io/packagist/v/brotkrueml/typo3-matomo-widgets.svg?label=stable)](https://packagist.org/packages/brotkrueml/typo3-matomo-widgets)
[![Total Downloads](https://img.shields.io/packagist/dt/brotkrueml/typo3-matomo-widgets.svg)](https://packagist.org/packages/brotkrueml/typo3-matomo-widgets)

## Versions and support

| Latest release | TYPO3 | PHP | Updates will contain |
|----------------|-------------|-------|------------------------------------------------------|
| 3.x | 12.4 - 13.4 | ≥ 8.1 | Features, security and bug fixes |
| 2.x | 11.5 - 12.4 | ≥ 8.1 | Security and bug fixes, end of life expected: Oct 24 |
| 1.x | 10.4 - 11.5 | ≥ 7.4 | Security fixes, end of life expected: Oct 24 |
| 0.x | 10.4 - 11.5 | ≥ 7.2 | End of life |
| Latest release | TYPO3 | PHP | Updates will contain |
|----------------|-------------|-------|----------------------------------|
| 3.x | 12.4 / 13.4 | ≥ 8.1 | Features, security and bug fixes |
| 2.x | 11.5 / 12.4 | ≥ 8.1 | End of life (since Nov 2024) |
| 1.x | 10.4 / 11.5 | ≥ 7.4 | End of life (since Nov 2024) |
| 0.x | 10.4 / 11.5 | ≥ 7.2 | End of life (since May 2021) |

[Documentation](https://docs.typo3.org/p/brotkrueml/typo3-matomo-widgets/main/en-us/) |
[Translation](https://crowdin.com/project/typo3-extension-matomowidgets) |
Expand Down
16 changes: 16 additions & 0 deletions Tests/Unit/Configuration/ConfigurationFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,22 @@ public function siteConfigurationAndAdditionalConfigurationAreBothTakenIntoAccou
self::assertTrue($configurationArray[1]->isWidgetActive('actionsPerDay'));
}

#[Test]
public function siteConfigurationWithRelativeUrlFromMatomoIntegrationUsesSchemeFromBase(): void
{
$this->createSiteConfiguration('some_site', [
'base' => 'https://example.com/',
'matomoWidgetsConsiderMatomoIntegration' => true,
'matomoIntegrationSiteId' => 1,
'matomoIntegrationUrl' => '//matomo.example.com/',
]);

$configurations = ConfigurationFinder::buildConfigurations(self::$configPath, true);
$actualConfiguration = $configurations->getIterator()->current();

self::assertSame('https://matomo.example.com/', $actualConfiguration->url);
}

private function createSiteConfiguration(string $identifier, array $configuration): void
{
$path = self::$configPath . '/sites/' . $identifier;
Expand Down
7 changes: 3 additions & 4 deletions Tests/Unit/Controller/CreateAnnotationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ final class CreateAnnotationControllerTest extends TestCase
private MatomoRepository&Stub $matomoRepositoryStub;
private CreateAnnotationController $subject;
private BackendUserAuthentication&Stub $backendUserStub;
private LanguageService&Stub $languageServiceStub;
private ServerRequestInterface&Stub $serverRequestStub;

protected function setUp(): void
Expand Down Expand Up @@ -73,11 +72,11 @@ protected function setUp(): void
$this->backendUserStub = $this->createStub(BackendUserAuthentication::class);
$GLOBALS['BE_USER'] = $this->backendUserStub;

$this->languageServiceStub = $this->createStub(LanguageService::class);
$this->languageServiceStub
$languageServiceStub = $this->createStub(LanguageService::class);
$languageServiceStub
->method('sL')
->willReturnCallback(static fn(string $key): string => $key);
$GLOBALS['LANG'] = $this->languageServiceStub;
$GLOBALS['LANG'] = $languageServiceStub;

$this->serverRequestStub = $this->createStub(ServerRequestInterface::class);
}
Expand Down
6 changes: 2 additions & 4 deletions Tests/Unit/Domain/Repository/MatomoRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Stub;
use PHPUnit\Framework\TestCase;
use Psr\EventDispatcher\EventDispatcherInterface;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\EventDispatcher\NoopEventDispatcher;

Expand All @@ -30,21 +29,20 @@ final class MatomoRepositoryTest extends TestCase
{
private MatomoConnector&MockObject $connectorMock;
private FrontendInterface&Stub $cacheStub;
private EventDispatcherInterface $eventDispatcher;
private ConnectionConfiguration $connectionConfiguration;
private MatomoRepository $subject;

protected function setUp(): void
{
$this->connectorMock = $this->createMock(MatomoConnector::class);
$this->cacheStub = $this->createStub(FrontendInterface::class);
$this->eventDispatcher = new NoopEventDispatcher();
$eventDispatcher = new NoopEventDispatcher();

$this->subject = new MatomoRepository(
$this->cacheStub,
new CacheIdentifierCreator(),
$this->connectorMock,
$this->eventDispatcher,
$eventDispatcher,
);

$this->connectionConfiguration = new ConnectionConfiguration('https://example.net', 3, '');
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@
"require": {
"php": ">=8.1",
"symfony/finder": "^6.4 || ^7.0",
"typo3/cms-core": "^12.4 || ^13.3",
"typo3/cms-dashboard": "^12.4 || ^13.3"
"typo3/cms-core": "^12.4 || ^13.4",
"typo3/cms-dashboard": "^12.4 || ^13.4"
},
"require-dev": {
"brotkrueml/coding-standards": "~6.0.0",
"brotkrueml/coding-standards": "~6.1.0",
"brotkrueml/typo3-matomo-integration": "^1.0 || ^2.0",
"donatj/mock-webserver": "^2.7",
"ergebnis/composer-normalize": "~2.43.0",
"ergebnis/composer-normalize": "~2.44.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "1.12.4",
"phpunit/phpunit": "^10.5 || ^11.3",
"rector/rector": "1.2.5",
"phpstan/phpstan": "1.12.12",
"phpunit/phpunit": "^10.5 || ^11.4",
"rector/rector": "1.2.10",
"saschaegerer/phpstan-typo3": "^1.10",
"symfony/yaml": "^6.4 || ^7.0",
"symfony/yaml": "^6.4 || ^7.2",
"symplify/phpstan-rules": "^13.0",
"tomasvotruba/cognitive-complexity": "^0.2.3"
},
Expand Down Expand Up @@ -67,7 +67,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "3.1.x-dev"
"dev-main": "3.2.x-dev"
},
"typo3/cms": {
"extension-key": "matomo_widgets",
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'author' => 'Chris Müller',
'author_email' => 'typo3@brotkrueml.dev',
'state' => 'stable',
'version' => '3.1.1',
'version' => '3.2.0-dev',
'constraints' => [
'depends' => [
'php' => '8.1.0-0.0.0',
Expand Down
2 changes: 1 addition & 1 deletion phpstan.baseline.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
ignoreErrors:
-
message: "#^Cognitive complexity for \"Brotkrueml\\\\MatomoWidgets\\\\Configuration\\\\ConfigurationFinder\\:\\:buildConfigurations\\(\\)\" is 13, keep it under 8$#"
message: "#^Cognitive complexity for \"Brotkrueml\\\\MatomoWidgets\\\\Configuration\\\\ConfigurationFinder\\:\\:buildConfigurations\\(\\)\" is 14, keep it under 8$#"
count: 1
path: Classes/Configuration/ConfigurationFinder.php

Expand Down

0 comments on commit 123bfab

Please sign in to comment.