mirror of
https://github.com/DanielSiepmann/tracking.git
synced 2024-11-21 21:46:09 +01:00
Update PHPStan
PHPStan was released with first stable public version 1.x. The version is updated together with extensions. The new version finds new issues which are solved right away to not break CI.
This commit is contained in:
parent
e55f1da281
commit
456c86b492
13 changed files with 134 additions and 104 deletions
|
@ -97,6 +97,10 @@ class NewestPageviews implements ListDataProviderInterface
|
||||||
|
|
||||||
$items = $this->queryBuilder->execute()->fetchAll();
|
$items = $this->queryBuilder->execute()->fetchAll();
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
if (is_array($item) === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$preparedItems[] = sprintf(
|
$preparedItems[] = sprintf(
|
||||||
'%s - %s',
|
'%s - %s',
|
||||||
$item['url'],
|
$item['url'],
|
||||||
|
|
|
@ -114,6 +114,10 @@ class PageviewsPerOperatingSystem implements ChartDataProviderInterface
|
||||||
->fetchAll();
|
->fetchAll();
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
|
if (is_array($row) === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$labels[] = mb_strimwidth($row['operating_system'], 0, 50, '…');
|
$labels[] = mb_strimwidth($row['operating_system'], 0, 50, '…');
|
||||||
$data[] = $row['total'];
|
$data[] = $row['total'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,10 @@ class PageviewsPerPage implements ChartDataProviderInterface
|
||||||
->fetchAll();
|
->fetchAll();
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
|
if (is_array($row) === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$labels[] = $this->getRecordTitle($row['pid']);
|
$labels[] = $this->getRecordTitle($row['pid']);
|
||||||
$data[] = $row['total'];
|
$data[] = $row['total'];
|
||||||
}
|
}
|
||||||
|
@ -157,6 +161,10 @@ class PageviewsPerPage implements ChartDataProviderInterface
|
||||||
$record = $this->pageRepository->getRecordOverlay('pages', $record, $this->languageLimitation[0]);
|
$record = $this->pageRepository->getRecordOverlay('pages', $record, $this->languageLimitation[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($record) === false) {
|
||||||
|
return 'Unkown';
|
||||||
|
}
|
||||||
|
|
||||||
return strip_tags(BackendUtility::getRecordTitle('pages', $record, true));
|
return strip_tags(BackendUtility::getRecordTitle('pages', $record, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ use Doctrine\DBAL\ParameterType;
|
||||||
use Doctrine\DBAL\Statement;
|
use Doctrine\DBAL\Statement;
|
||||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||||
use TYPO3\CMS\Core\Database\Connection;
|
use TYPO3\CMS\Core\Database\Connection;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
|
||||||
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
|
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
|
||||||
use TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction;
|
use TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction;
|
||||||
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
|
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
|
||||||
|
@ -37,11 +36,6 @@ use TYPO3\CMS\Dashboard\Widgets\ChartDataProviderInterface;
|
||||||
|
|
||||||
class Recordviews implements ChartDataProviderInterface
|
class Recordviews implements ChartDataProviderInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var ConnectionPool
|
|
||||||
*/
|
|
||||||
private $connectionPool;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PageRepository
|
* @var PageRepository
|
||||||
*/
|
*/
|
||||||
|
@ -83,7 +77,6 @@ class Recordviews implements ChartDataProviderInterface
|
||||||
private $recordTypeLimitation;
|
private $recordTypeLimitation;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ConnectionPool $connectionPool,
|
|
||||||
PageRepository $pageRepository,
|
PageRepository $pageRepository,
|
||||||
QueryBuilder $queryBuilder,
|
QueryBuilder $queryBuilder,
|
||||||
int $days = 31,
|
int $days = 31,
|
||||||
|
@ -93,7 +86,6 @@ class Recordviews implements ChartDataProviderInterface
|
||||||
array $recordTableLimitation = [],
|
array $recordTableLimitation = [],
|
||||||
array $recordTypeLimitation = []
|
array $recordTypeLimitation = []
|
||||||
) {
|
) {
|
||||||
$this->connectionPool = $connectionPool;
|
|
||||||
$this->pageRepository = $pageRepository;
|
$this->pageRepository = $pageRepository;
|
||||||
$this->queryBuilder = $queryBuilder;
|
$this->queryBuilder = $queryBuilder;
|
||||||
$this->days = $days;
|
$this->days = $days;
|
||||||
|
@ -131,8 +123,11 @@ class Recordviews implements ChartDataProviderInterface
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$this->recordTypeLimitation !== []
|
$record === null
|
||||||
&& in_array($record['type'], $this->recordTypeLimitation) === false
|
|| (
|
||||||
|
$this->recordTypeLimitation !== []
|
||||||
|
&& in_array($record['type'], $this->recordTypeLimitation) === false
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +203,7 @@ class Recordviews implements ChartDataProviderInterface
|
||||||
private function getRecord(
|
private function getRecord(
|
||||||
int $uid,
|
int $uid,
|
||||||
string $table
|
string $table
|
||||||
): array {
|
): ?array {
|
||||||
$recordTypeField = $GLOBALS['TCA'][$table]['ctrl']['type'] ?? '';
|
$recordTypeField = $GLOBALS['TCA'][$table]['ctrl']['type'] ?? '';
|
||||||
|
|
||||||
$record = BackendUtility::getRecord($table, $uid);
|
$record = BackendUtility::getRecord($table, $uid);
|
||||||
|
@ -216,6 +211,10 @@ class Recordviews implements ChartDataProviderInterface
|
||||||
$record = $this->pageRepository->getRecordOverlay($table, $record, $this->languageLimitation[0]);
|
$record = $this->pageRepository->getRecordOverlay($table, $record, $this->languageLimitation[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($record) === false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'title' => strip_tags(BackendUtility::getRecordTitle($table, $record, true)),
|
'title' => strip_tags(BackendUtility::getRecordTitle($table, $record, true)),
|
||||||
'type' => $record[$recordTypeField] ?? '',
|
'type' => $record[$recordTypeField] ?? '',
|
||||||
|
|
|
@ -23,11 +23,6 @@ namespace DanielSiepmann\Tracking\Domain\Model;
|
||||||
|
|
||||||
class RecordRule
|
class RecordRule
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $identifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -44,12 +39,10 @@ class RecordRule
|
||||||
private $tableName;
|
private $tableName;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $identifier,
|
|
||||||
string $matches,
|
string $matches,
|
||||||
string $recordUid,
|
string $recordUid,
|
||||||
string $tableName
|
string $tableName
|
||||||
) {
|
) {
|
||||||
$this->identifier = $identifier;
|
|
||||||
$this->matches = $matches;
|
$this->matches = $matches;
|
||||||
$this->recordUid = $recordUid;
|
$this->recordUid = $recordUid;
|
||||||
$this->tableName = $tableName;
|
$this->tableName = $tableName;
|
||||||
|
@ -58,7 +51,6 @@ class RecordRule
|
||||||
public static function fromArray(array $config): self
|
public static function fromArray(array $config): self
|
||||||
{
|
{
|
||||||
return new RecordRule(
|
return new RecordRule(
|
||||||
$config['identifier'],
|
|
||||||
$config['matches'],
|
$config['matches'],
|
||||||
$config['recordUid'],
|
$config['recordUid'],
|
||||||
$config['tableName']
|
$config['tableName']
|
||||||
|
@ -68,13 +60,8 @@ class RecordRule
|
||||||
public static function multipleFromArray(array $configs): array
|
public static function multipleFromArray(array $configs): array
|
||||||
{
|
{
|
||||||
$rules = [];
|
$rules = [];
|
||||||
foreach ($configs as $identifier => $config) {
|
foreach ($configs as $config) {
|
||||||
$rules[] = static::fromArray(array_merge(
|
$rules[] = static::fromArray($config);
|
||||||
[
|
|
||||||
'identifier' => $identifier,
|
|
||||||
],
|
|
||||||
$config
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace DanielSiepmann\Tracking\Domain\Pageview;
|
||||||
use DanielSiepmann\Tracking\Domain\Model\Pageview;
|
use DanielSiepmann\Tracking\Domain\Model\Pageview;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use TYPO3\CMS\Core\Routing\PageArguments;
|
use TYPO3\CMS\Core\Routing\PageArguments;
|
||||||
|
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
||||||
use TYPO3\CMS\Core\Site\SiteFinder;
|
use TYPO3\CMS\Core\Site\SiteFinder;
|
||||||
|
|
||||||
class Factory
|
class Factory
|
||||||
|
@ -41,10 +42,10 @@ class Factory
|
||||||
public static function fromRequest(ServerRequestInterface $request): Pageview
|
public static function fromRequest(ServerRequestInterface $request): Pageview
|
||||||
{
|
{
|
||||||
return new Pageview(
|
return new Pageview(
|
||||||
static::getRouting($request)->getPageId(),
|
self::getRouting($request)->getPageId(),
|
||||||
$request->getAttribute('language'),
|
self::getLanguage($request),
|
||||||
new \DateTimeImmutable(),
|
new \DateTimeImmutable(),
|
||||||
(int) static::getRouting($request)->getPageType(),
|
(int) self::getRouting($request)->getPageType(),
|
||||||
(string) $request->getUri(),
|
(string) $request->getUri(),
|
||||||
$request->getHeader('User-Agent')[0] ?? ''
|
$request->getHeader('User-Agent')[0] ?? ''
|
||||||
);
|
);
|
||||||
|
@ -63,8 +64,25 @@ class Factory
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function getLanguage(ServerRequestInterface $request): SiteLanguage
|
||||||
|
{
|
||||||
|
$language = $request->getAttribute('language');
|
||||||
|
|
||||||
|
if (!$language instanceof SiteLanguage) {
|
||||||
|
throw new \UnexpectedValueException('Could not fetch SiteLanguage from request attributes.', 1637847002);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $language;
|
||||||
|
}
|
||||||
|
|
||||||
private static function getRouting(ServerRequestInterface $request): PageArguments
|
private static function getRouting(ServerRequestInterface $request): PageArguments
|
||||||
{
|
{
|
||||||
return $request->getAttribute('routing');
|
$routing = $request->getAttribute('routing');
|
||||||
|
|
||||||
|
if (!$routing instanceof PageArguments) {
|
||||||
|
throw new \UnexpectedValueException('Could not fetch PageArguments from request attributes.', 1637847002);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $routing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ use DanielSiepmann\Tracking\Domain\Model\Recordview;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||||
use TYPO3\CMS\Core\Routing\PageArguments;
|
use TYPO3\CMS\Core\Routing\PageArguments;
|
||||||
|
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
||||||
|
|
||||||
class Factory
|
class Factory
|
||||||
{
|
{
|
||||||
|
@ -39,19 +40,47 @@ class Factory
|
||||||
['request' => $request]
|
['request' => $request]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (is_numeric($recordUid) === false) {
|
||||||
|
throw new \UnexpectedValueException(
|
||||||
|
sprintf(
|
||||||
|
'Could not determine record uid based on expression: "%1$s", got type "%2$s".',
|
||||||
|
$rule->getUidExpression(),
|
||||||
|
gettype($recordUid)
|
||||||
|
),
|
||||||
|
1637846881
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return new Recordview(
|
return new Recordview(
|
||||||
static::getRouting($request)->getPageId(),
|
self::getRouting($request)->getPageId(),
|
||||||
$request->getAttribute('language'),
|
self::getLanguage($request),
|
||||||
new \DateTimeImmutable(),
|
new \DateTimeImmutable(),
|
||||||
(string) $request->getUri(),
|
(string) $request->getUri(),
|
||||||
$request->getHeader('User-Agent')[0] ?? '',
|
$request->getHeader('User-Agent')[0] ?? '',
|
||||||
$recordUid,
|
(int) $recordUid,
|
||||||
$rule->getTableName()
|
$rule->getTableName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function getLanguage(ServerRequestInterface $request): SiteLanguage
|
||||||
|
{
|
||||||
|
$language = $request->getAttribute('language');
|
||||||
|
|
||||||
|
if (!$language instanceof SiteLanguage) {
|
||||||
|
throw new \UnexpectedValueException('Could not fetch SiteLanguage from request attributes.', 1637847002);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $language;
|
||||||
|
}
|
||||||
|
|
||||||
private static function getRouting(ServerRequestInterface $request): PageArguments
|
private static function getRouting(ServerRequestInterface $request): PageArguments
|
||||||
{
|
{
|
||||||
return $request->getAttribute('routing');
|
$routing = $request->getAttribute('routing');
|
||||||
|
|
||||||
|
if (!$routing instanceof PageArguments) {
|
||||||
|
throw new \UnexpectedValueException('Could not fetch PageArguments from request attributes.', 1637847002);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $routing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,17 @@ class Pageview
|
||||||
|
|
||||||
public function countAll(): int
|
public function countAll(): int
|
||||||
{
|
{
|
||||||
return $this->connection->createQueryBuilder()
|
$result = $this->connection->createQueryBuilder()
|
||||||
->count('uid')
|
->count('uid')
|
||||||
->from('tx_tracking_pageview')
|
->from('tx_tracking_pageview')
|
||||||
->execute()
|
->execute()
|
||||||
->fetchColumn();
|
->fetchColumn();
|
||||||
|
|
||||||
|
if (is_numeric($result)) {
|
||||||
|
return (int) $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findAll(): \Generator
|
public function findAll(): \Generator
|
||||||
|
@ -60,6 +66,10 @@ class Pageview
|
||||||
$pageViews = $queryBuilder->select('*')->from('tx_tracking_pageview')->execute();
|
$pageViews = $queryBuilder->select('*')->from('tx_tracking_pageview')->execute();
|
||||||
|
|
||||||
while ($pageView = $pageViews->fetch()) {
|
while ($pageView = $pageViews->fetch()) {
|
||||||
|
if (is_array($pageView) === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
yield $this->factory->fromDbRow($pageView);
|
yield $this->factory->fromDbRow($pageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use DanielSiepmann\Tracking\Dashboard\Provider\Recordviews;
|
use DanielSiepmann\Tracking\Dashboard\Provider\Recordviews;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
|
||||||
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
|
||||||
|
@ -52,13 +51,9 @@ class RecordviewsTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview')
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview')
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $subject->getChartData();
|
$result = $subject->getChartData();
|
||||||
|
@ -105,13 +100,9 @@ class RecordviewsTest extends TestCase
|
||||||
'record_table_name' => 'sys_category',
|
'record_table_name' => 'sys_category',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -150,13 +141,9 @@ class RecordviewsTest extends TestCase
|
||||||
'record_table_name' => 'sys_category',
|
'record_table_name' => 'sys_category',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -184,13 +171,9 @@ class RecordviewsTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
31,
|
31,
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
@ -220,13 +203,9 @@ class RecordviewsTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
31,
|
31,
|
||||||
6,
|
6,
|
||||||
[1, 2, 3, 4, 5]
|
[1, 2, 3, 4, 5]
|
||||||
|
@ -265,13 +244,9 @@ class RecordviewsTest extends TestCase
|
||||||
'record_table_name' => 'tt_content',
|
'record_table_name' => 'tt_content',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
31,
|
31,
|
||||||
6,
|
6,
|
||||||
[],
|
[],
|
||||||
|
@ -308,13 +283,9 @@ class RecordviewsTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
31,
|
31,
|
||||||
6,
|
6,
|
||||||
[],
|
[],
|
||||||
|
@ -360,13 +331,9 @@ class RecordviewsTest extends TestCase
|
||||||
'record_table_name' => 'sys_category',
|
'record_table_name' => 'sys_category',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
31,
|
31,
|
||||||
6,
|
6,
|
||||||
[],
|
[],
|
||||||
|
@ -412,13 +379,9 @@ class RecordviewsTest extends TestCase
|
||||||
'record_table_name' => 'sys_category',
|
'record_table_name' => 'sys_category',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
||||||
/* @var ConnectionPool $connectionPool */
|
|
||||||
|
|
||||||
$subject = new Recordviews(
|
$subject = new Recordviews(
|
||||||
$connectionPool,
|
|
||||||
GeneralUtility::makeInstance(PageRepository::class),
|
GeneralUtility::makeInstance(PageRepository::class),
|
||||||
$connectionPool->getQueryBuilderForTable('tx_tracking_recordview'),
|
$this->getConnectionPool()->getQueryBuilderForTable('tx_tracking_recordview'),
|
||||||
31,
|
31,
|
||||||
6,
|
6,
|
||||||
[],
|
[],
|
||||||
|
|
|
@ -36,16 +36,32 @@ class Typo3FeaturesTest extends TestCase
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Typo3FeaturesTest/PageWithRecords.xml');
|
||||||
|
$this->setUpBackendUserFromFixture(1);
|
||||||
|
$languageServiceFactory = $this->getContainer()->get(LanguageServiceFactory::class);
|
||||||
|
if (!$languageServiceFactory instanceof LanguageServiceFactory) {
|
||||||
|
throw new \UnexpectedValueException('Did not retrieve LanguageServiceFactory.', 1637847250);
|
||||||
|
}
|
||||||
|
$GLOBALS['LANG'] = $languageServiceFactory->create('default');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tearDown(): void
|
||||||
|
{
|
||||||
|
unset($GLOBALS['LANG']);
|
||||||
|
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @testdox Copy pages. Tracking records will not be copied.
|
* @testdox Copy pages. Tracking records will not be copied.
|
||||||
*/
|
*/
|
||||||
public function copyContainingRecords(): void
|
public function copyContainingRecords(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Typo3FeaturesTest/PageWithRecords.xml');
|
|
||||||
$this->setUpBackendUserFromFixture(1);
|
|
||||||
$GLOBALS['LANG'] = $this->getContainer()->get(LanguageServiceFactory::class)->create('default');
|
|
||||||
|
|
||||||
$dataHandler = new DataHandler();
|
$dataHandler = new DataHandler();
|
||||||
$dataHandler->start([], [
|
$dataHandler->start([], [
|
||||||
'pages' => [
|
'pages' => [
|
||||||
|
@ -68,10 +84,6 @@ class Typo3FeaturesTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function copyCustomTablesViaDataHandler(): void
|
public function copyCustomTablesViaDataHandler(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Typo3FeaturesTest/PageWithRecords.xml');
|
|
||||||
$this->setUpBackendUserFromFixture(1);
|
|
||||||
$GLOBALS['LANG'] = $this->getContainer()->get(LanguageServiceFactory::class)->create('default');
|
|
||||||
|
|
||||||
$dataHandler = new DataHandler();
|
$dataHandler = new DataHandler();
|
||||||
$dataHandler->copyWhichTables = 'pages,tx_tracking_pageview,tx_tracking_recordview';
|
$dataHandler->copyWhichTables = 'pages,tx_tracking_pageview,tx_tracking_recordview';
|
||||||
$dataHandler->start([], [
|
$dataHandler->start([], [
|
||||||
|
|
|
@ -35,7 +35,6 @@ class RecordRuleTest extends TestCase
|
||||||
public function canBeCreatedViaConstructor(): void
|
public function canBeCreatedViaConstructor(): void
|
||||||
{
|
{
|
||||||
$subject = new RecordRule(
|
$subject = new RecordRule(
|
||||||
'',
|
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
''
|
''
|
||||||
|
@ -88,7 +87,6 @@ class RecordRuleTest extends TestCase
|
||||||
public function returnsMatchExpression(): void
|
public function returnsMatchExpression(): void
|
||||||
{
|
{
|
||||||
$subject = new RecordRule(
|
$subject = new RecordRule(
|
||||||
'',
|
|
||||||
'match expression',
|
'match expression',
|
||||||
'',
|
'',
|
||||||
''
|
''
|
||||||
|
@ -103,7 +101,6 @@ class RecordRuleTest extends TestCase
|
||||||
public function returnsUidExpression(): void
|
public function returnsUidExpression(): void
|
||||||
{
|
{
|
||||||
$subject = new RecordRule(
|
$subject = new RecordRule(
|
||||||
'',
|
|
||||||
'',
|
'',
|
||||||
'match expression',
|
'match expression',
|
||||||
''
|
''
|
||||||
|
@ -118,7 +115,6 @@ class RecordRuleTest extends TestCase
|
||||||
public function returnsTableName(): void
|
public function returnsTableName(): void
|
||||||
{
|
{
|
||||||
$subject = new RecordRule(
|
$subject = new RecordRule(
|
||||||
'',
|
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'table_name'
|
'table_name'
|
||||||
|
|
|
@ -43,7 +43,7 @@ class FactoryTest extends TestCase
|
||||||
public function returnsRecordviewFromRequest(): void
|
public function returnsRecordviewFromRequest(): void
|
||||||
{
|
{
|
||||||
$rule = $this->prophesize(RecordRule::class);
|
$rule = $this->prophesize(RecordRule::class);
|
||||||
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"] > 0');
|
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"]');
|
||||||
$rule->getTableName()->willReturn('sys_category');
|
$rule->getTableName()->willReturn('sys_category');
|
||||||
|
|
||||||
$routing = $this->prophesize(PageArguments::class);
|
$routing = $this->prophesize(PageArguments::class);
|
||||||
|
@ -70,7 +70,7 @@ class FactoryTest extends TestCase
|
||||||
public function returnedRecordviewContainsUserAgent(): void
|
public function returnedRecordviewContainsUserAgent(): void
|
||||||
{
|
{
|
||||||
$rule = $this->prophesize(RecordRule::class);
|
$rule = $this->prophesize(RecordRule::class);
|
||||||
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"] > 0');
|
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"]');
|
||||||
$rule->getTableName()->willReturn('sys_category');
|
$rule->getTableName()->willReturn('sys_category');
|
||||||
|
|
||||||
$routing = $this->prophesize(PageArguments::class);
|
$routing = $this->prophesize(PageArguments::class);
|
||||||
|
@ -97,7 +97,7 @@ class FactoryTest extends TestCase
|
||||||
public function returnedRecordviewContainsUri(): void
|
public function returnedRecordviewContainsUri(): void
|
||||||
{
|
{
|
||||||
$rule = $this->prophesize(RecordRule::class);
|
$rule = $this->prophesize(RecordRule::class);
|
||||||
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"] > 0');
|
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"]');
|
||||||
$rule->getTableName()->willReturn('sys_category');
|
$rule->getTableName()->willReturn('sys_category');
|
||||||
|
|
||||||
$routing = $this->prophesize(PageArguments::class);
|
$routing = $this->prophesize(PageArguments::class);
|
||||||
|
@ -124,7 +124,7 @@ class FactoryTest extends TestCase
|
||||||
public function returnedRecordviewContainsDateTime(): void
|
public function returnedRecordviewContainsDateTime(): void
|
||||||
{
|
{
|
||||||
$rule = $this->prophesize(RecordRule::class);
|
$rule = $this->prophesize(RecordRule::class);
|
||||||
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"] > 0');
|
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"]');
|
||||||
$rule->getTableName()->willReturn('sys_category');
|
$rule->getTableName()->willReturn('sys_category');
|
||||||
|
|
||||||
$routing = $this->prophesize(PageArguments::class);
|
$routing = $this->prophesize(PageArguments::class);
|
||||||
|
@ -151,7 +151,7 @@ class FactoryTest extends TestCase
|
||||||
public function returnedRecordviewContainsLanguage(): void
|
public function returnedRecordviewContainsLanguage(): void
|
||||||
{
|
{
|
||||||
$rule = $this->prophesize(RecordRule::class);
|
$rule = $this->prophesize(RecordRule::class);
|
||||||
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"] > 0');
|
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"]');
|
||||||
$rule->getTableName()->willReturn('sys_category');
|
$rule->getTableName()->willReturn('sys_category');
|
||||||
|
|
||||||
$routing = $this->prophesize(PageArguments::class);
|
$routing = $this->prophesize(PageArguments::class);
|
||||||
|
@ -178,7 +178,7 @@ class FactoryTest extends TestCase
|
||||||
public function returnedRecordviewContainsPageId(): void
|
public function returnedRecordviewContainsPageId(): void
|
||||||
{
|
{
|
||||||
$rule = $this->prophesize(RecordRule::class);
|
$rule = $this->prophesize(RecordRule::class);
|
||||||
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"] > 0');
|
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"]');
|
||||||
$rule->getTableName()->willReturn('sys_category');
|
$rule->getTableName()->willReturn('sys_category');
|
||||||
|
|
||||||
$routing = $this->prophesize(PageArguments::class);
|
$routing = $this->prophesize(PageArguments::class);
|
||||||
|
@ -232,7 +232,7 @@ class FactoryTest extends TestCase
|
||||||
public function returnedRecordviewContainsTableName(): void
|
public function returnedRecordviewContainsTableName(): void
|
||||||
{
|
{
|
||||||
$rule = $this->prophesize(RecordRule::class);
|
$rule = $this->prophesize(RecordRule::class);
|
||||||
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"] > 0');
|
$rule->getUidExpression()->willReturn('request.getQueryParams()["category"]');
|
||||||
$rule->getTableName()->willReturn('sys_category');
|
$rule->getTableName()->willReturn('sys_category');
|
||||||
|
|
||||||
$routing = $this->prophesize(PageArguments::class);
|
$routing = $this->prophesize(PageArguments::class);
|
||||||
|
|
|
@ -40,12 +40,12 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9.0",
|
"phpunit/phpunit": "^9.0",
|
||||||
"phpstan/phpstan": "^0.12.18",
|
"phpstan/phpstan": "^1.2",
|
||||||
"phpstan/extension-installer": "^1.0",
|
"phpstan/extension-installer": "^1.1",
|
||||||
"jangregor/phpstan-prophecy": "^0.8.1",
|
"jangregor/phpstan-prophecy": "^1.0",
|
||||||
"phpspec/prophecy-phpunit": "^2.0",
|
"phpspec/prophecy-phpunit": "^2.0",
|
||||||
"typo3/testing-framework": "^6.14",
|
"typo3/testing-framework": "^6.14",
|
||||||
"saschaegerer/phpstan-typo3": "^0.13.1",
|
"saschaegerer/phpstan-typo3": "^1.0",
|
||||||
"symplify/easy-coding-standard": "^9.3",
|
"symplify/easy-coding-standard": "^9.3",
|
||||||
"cweagans/composer-patches": "^1.7"
|
"cweagans/composer-patches": "^1.7"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue