mirror of
https://github.com/DanielSiepmann/tracking.git
synced 2024-11-24 14:36:08 +01:00
Raise to TYPO3 v13.4 LTS
This commit is contained in:
parent
f50cbacdab
commit
50f2a95156
4 changed files with 59 additions and 19 deletions
|
@ -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'],
|
||||
|
|
40
Classes/Domain/Repository/Site.php
Normal file
40
Classes/Domain/Repository/Site.php
Normal 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);
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue