Raise to TYPO3 v13.4 LTS

This commit is contained in:
Daniel Siepmann (Codappix) 2024-10-15 13:54:58 +02:00
parent f50cbacdab
commit 50f2a95156
SSH key fingerprint: SHA256:nAjx3Dpp8kuAC+S7QXj8BWmqw+KI1Miu+5e40BP3LXA
4 changed files with 59 additions and 19 deletions

View file

@ -24,17 +24,17 @@ declare(strict_types=1);
namespace DanielSiepmann\Tracking\Domain\Pageview;
use DanielSiepmann\Tracking\Domain\Model\Pageview;
use DanielSiepmann\Tracking\Domain\Repository\Site;
use DateTimeImmutable;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Site\SiteFinder;
use UnexpectedValueException;
class Factory
{
public function __construct(
private readonly SiteFinder $siteFinder
private readonly Site $siteRepository
) {
}
@ -54,7 +54,7 @@ class Factory
{
return new Pageview(
(int) $dbRow['pid'],
$this->siteFinder->getSiteByPageId((int) $dbRow['pid'])->getLanguageById((int) $dbRow['sys_language_uid']),
$this->siteRepository->findByPageUid((int) $dbRow['pid'])->getLanguageById((int) $dbRow['sys_language_uid']),
new DateTimeImmutable('@' . $dbRow['crdate']),
(int) $dbRow['type'],
$dbRow['url'],

View file

@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/*
* Copyright (C) 2024 Daniel Siepmann <daniel.siepmann@codappix.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann\Tracking\Domain\Repository;
use TYPO3\CMS\Core\Site\Entity\Site as SiteEntity;
use TYPO3\CMS\Core\Site\SiteFinder;
class Site
{
public function __construct(
private readonly SiteFinder $siteFinder
) {
}
public function findByPageUid(int $pageUid): SiteEntity
{
return $this->siteFinder->getSiteByPageId($pageUid);
}
}

View file

@ -24,14 +24,14 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Pageview;
*/
use DanielSiepmann\Tracking\Domain\Model\Pageview;
use DanielSiepmann\Tracking\Domain\Pageview\Factory;
use DanielSiepmann\Tracking\Domain\Repository\Site;
use DateTimeImmutable;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\Entity\Site as SiteEntity;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
#[CoversClass(Factory::class)]
@ -54,7 +54,7 @@ class FactoryTest extends UnitTestCase
$request->method('getUri')->willReturn('');
$request->method('getHeader')->willReturn([]);
$subject = new Factory($this->createStub(SiteFinder::class));
$subject = new Factory($this->createStub(Site::class));
$result = $subject->fromRequest($request);
self::assertInstanceOf(Pageview::class, $result);
@ -79,7 +79,7 @@ class FactoryTest extends UnitTestCase
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0',
]);
$subject = new Factory($this->createStub(SiteFinder::class));
$subject = new Factory($this->createStub(Site::class));
$result = $subject->fromRequest($request);
self::assertSame(
@ -105,7 +105,7 @@ class FactoryTest extends UnitTestCase
$request->method('getUri')->willReturn('https://example.com/path?query=params&some=more#anchor');
$request->method('getHeader')->willReturn([]);
$subject = new Factory($this->createStub(SiteFinder::class));
$subject = new Factory($this->createStub(Site::class));
$result = $subject->fromRequest($request);
self::assertSame(
@ -131,7 +131,7 @@ class FactoryTest extends UnitTestCase
$request->method('getUri')->willReturn('');
$request->method('getHeader')->willReturn([]);
$subject = new Factory($this->createStub(SiteFinder::class));
$subject = new Factory($this->createStub(Site::class));
$result = $subject->fromRequest($request);
self::assertSame(
@ -157,7 +157,7 @@ class FactoryTest extends UnitTestCase
$request->method('getUri')->willReturn('');
$request->method('getHeader')->willReturn([]);
$subject = new Factory($this->createStub(SiteFinder::class));
$subject = new Factory($this->createStub(Site::class));
$result = $subject->fromRequest($request);
self::assertInstanceOf(DateTimeImmutable::class, $result->getCrdate());
@ -180,7 +180,7 @@ class FactoryTest extends UnitTestCase
$request->method('getUri')->willReturn('');
$request->method('getHeader')->willReturn([]);
$subject = new Factory($this->createStub(SiteFinder::class));
$subject = new Factory($this->createStub(Site::class));
$result = $subject->fromRequest($request);
self::assertInstanceOf(SiteLanguage::class, $result->getLanguage());
@ -203,7 +203,7 @@ class FactoryTest extends UnitTestCase
$request->method('getUri')->willReturn('');
$request->method('getHeader')->willReturn([]);
$subject = new Factory($this->createStub(SiteFinder::class));
$subject = new Factory($this->createStub(Site::class));
$result = $subject->fromRequest($request);
self::assertSame(
@ -216,12 +216,12 @@ class FactoryTest extends UnitTestCase
public function returnsPageviewFromDbRow(): void
{
$siteLanguage = $this->createStub(SiteLanguage::class);
$site = $this->createStub(Site::class);
$site = $this->createStub(SiteEntity::class);
$site->method('getLanguageById')->willReturn($siteLanguage);
$siteFinder = $this->createStub(SiteFinder::class);
$siteFinder->method('getSiteByPageId')->willReturn($site);
$siteRepository = $this->createStub(Site::class);
$siteRepository->method('findByPageUid')->willReturn($site);
$subject = new Factory($siteFinder);
$subject = new Factory($siteRepository);
$result = $subject->fromDbRow([
'uid' => 1,

View file

@ -34,9 +34,9 @@
"psr/http-server-middleware": "^1.0",
"symfony/console": "^5.2 || ^6.1 || ^7.0",
"symfony/expression-language": "^5.2 || ^6.1 || ^7.0",
"typo3/cms-backend": "^12.4 || ^13.3",
"typo3/cms-core": "^12.4 || ^13.3",
"typo3/cms-dashboard": "^12.4 || ^13.3"
"typo3/cms-backend": "^12.4 || ^13.4",
"typo3/cms-core": "^12.4 || ^13.4",
"typo3/cms-dashboard": "^12.4 || ^13.4"
},
"require-dev": {
"codappix/typo3-php-datasets": "^1.5",