mirror of
https://github.com/DanielSiepmann/tracking.git
synced 2024-11-22 05:56:08 +01:00
Migrate test fixtures to PHP Data Sets
That will ease maintenance. XML is no longer supported by TYPO3 Testing Framework. Resolves: #109
This commit is contained in:
parent
bbeeea7f5c
commit
38a2be296a
30 changed files with 307 additions and 257 deletions
|
@ -25,6 +25,8 @@ Tasks
|
||||||
* Make sql within tests on CI more robust.
|
* Make sql within tests on CI more robust.
|
||||||
Wait until server has started before executing tests.
|
Wait until server has started before executing tests.
|
||||||
|
|
||||||
|
* Migrate test fixtures to PHP Data Sets using `codappix/typo3-php-datasets <https://packagist.org/packages/codappix/typo3-php-datasets>`_
|
||||||
|
|
||||||
Deprecation
|
Deprecation
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -21,16 +21,19 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Command;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use DanielSiepmann\Tracking\Command\UpdateDataCommand;
|
use DanielSiepmann\Tracking\Command\UpdateDataCommand;
|
||||||
use Symfony\Component\Console\Tester\CommandTester;
|
use Symfony\Component\Console\Tester\CommandTester;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Command\UpdateDataCommand
|
* @covers \DanielSiepmann\Tracking\Command\UpdateDataCommand
|
||||||
*/
|
*/
|
||||||
class UpdateDataCommandTest extends TestCase
|
class UpdateDataCommandTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
@ -44,7 +47,7 @@ class UpdateDataCommandTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function updatesAllEntriesWithMissingOperatingSystem(): void
|
public function updatesAllEntriesWithMissingOperatingSystem(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/UpdateDataCommandTest/PageviewsWithMissingOperatingSystem.xml');
|
$this->importPHPDataSet(__DIR__ . '/../Fixtures/UpdateDataCommandTest/PageviewsWithMissingOperatingSystem.php');
|
||||||
|
|
||||||
$subject = GeneralUtility::makeInstance(UpdateDataCommand::class);
|
$subject = GeneralUtility::makeInstance(UpdateDataCommand::class);
|
||||||
$tester = new CommandTester($subject);
|
$tester = new CommandTester($subject);
|
||||||
|
@ -63,7 +66,7 @@ class UpdateDataCommandTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function doesNotChangeExistingOperatingSystem(): void
|
public function doesNotChangeExistingOperatingSystem(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/UpdateDataCommandTest/PageviewsWithOperatingSystem.xml');
|
$this->importPHPDataSet(__DIR__ . '/../Fixtures/UpdateDataCommandTest/PageviewsWithOperatingSystem.php');
|
||||||
|
|
||||||
$subject = GeneralUtility::makeInstance(UpdateDataCommand::class);
|
$subject = GeneralUtility::makeInstance(UpdateDataCommand::class);
|
||||||
$tester = new CommandTester($subject);
|
$tester = new CommandTester($subject);
|
||||||
|
@ -82,7 +85,7 @@ class UpdateDataCommandTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function doesNothingIfNoRecordExists(): void
|
public function doesNothingIfNoRecordExists(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../Fixtures/Pages.php');
|
||||||
|
|
||||||
$subject = GeneralUtility::makeInstance(UpdateDataCommand::class);
|
$subject = GeneralUtility::makeInstance(UpdateDataCommand::class);
|
||||||
$tester = new CommandTester($subject);
|
$tester = new CommandTester($subject);
|
||||||
|
|
|
@ -24,12 +24,12 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
|
||||||
use DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews;
|
use DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews
|
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews
|
||||||
*/
|
*/
|
||||||
class NewestPageviewsTest extends TestCase
|
class NewestPageviewsTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
|
|
|
@ -21,17 +21,20 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerDay;
|
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerDay;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerDay
|
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerDay
|
||||||
*/
|
*/
|
||||||
class PageviewsPerDayTest extends TestCase
|
class PageviewsPerDayTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
@ -75,7 +78,7 @@ class PageviewsPerDayTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedNumberOfDays(): void
|
public function respectedNumberOfDays(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
|
@ -104,7 +107,7 @@ class PageviewsPerDayTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedExcludedPages(): void
|
public function respectedExcludedPages(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
|
@ -134,7 +137,7 @@ class PageviewsPerDayTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedDateFormat(): void
|
public function respectedDateFormat(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
|
|
||||||
$subject = new PageviewsPerDay(
|
$subject = new PageviewsPerDay(
|
||||||
|
|
|
@ -21,16 +21,19 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerOperatingSystem;
|
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerOperatingSystem;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerOperatingSystem
|
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerOperatingSystem
|
||||||
*/
|
*/
|
||||||
class PageviewsPerOperatingSystemTest extends TestCase
|
class PageviewsPerOperatingSystemTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
@ -70,7 +73,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedOrdering(): void
|
public function respectedOrdering(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
'pid' => 1,
|
'pid' => 1,
|
||||||
|
@ -111,7 +114,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedNumberOfDays(): void
|
public function respectedNumberOfDays(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
'pid' => 1,
|
'pid' => 1,
|
||||||
|
@ -147,7 +150,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedMaxResults(): void
|
public function respectedMaxResults(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
|
@ -178,7 +181,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectsLimitToLanguages(): void
|
public function respectsLimitToLanguages(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
|
|
|
@ -21,18 +21,21 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage;
|
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage;
|
||||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||||
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
||||||
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage
|
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage
|
||||||
*/
|
*/
|
||||||
class PageviewsPerPageTest extends TestCase
|
class PageviewsPerPageTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
@ -54,7 +57,7 @@ class PageviewsPerPageTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function listsSixResultsForLast31DaysByDefault(): void
|
public function listsSixResultsForLast31DaysByDefault(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
|
@ -85,7 +88,7 @@ class PageviewsPerPageTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedOrdering(): void
|
public function respectedOrdering(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
'pid' => 1,
|
'pid' => 1,
|
||||||
|
@ -123,7 +126,7 @@ class PageviewsPerPageTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedNumberOfDays(): void
|
public function respectedNumberOfDays(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
'pid' => 1,
|
'pid' => 1,
|
||||||
|
@ -157,7 +160,7 @@ class PageviewsPerPageTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedMaxResults(): void
|
public function respectedMaxResults(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
|
@ -188,7 +191,7 @@ class PageviewsPerPageTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedExcludedPages(): void
|
public function respectedExcludedPages(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
|
@ -220,7 +223,7 @@ class PageviewsPerPageTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function localizedRecordTitlesIfLimitedToSingleLanguage(): void
|
public function localizedRecordTitlesIfLimitedToSingleLanguage(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
'pid' => 1,
|
'pid' => 1,
|
||||||
|
@ -267,7 +270,7 @@ class PageviewsPerPageTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function defaultLanguageTitleIsUsedIfMultipleLanguagesAreAllowed(): void
|
public function defaultLanguageTitleIsUsedIfMultipleLanguagesAreAllowed(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/Pages.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
|
||||||
$connection->insert('tx_tracking_pageview', [
|
$connection->insert('tx_tracking_pageview', [
|
||||||
'pid' => 1,
|
'pid' => 1,
|
||||||
|
|
|
@ -21,17 +21,20 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use DanielSiepmann\Tracking\Dashboard\Provider\Recordviews;
|
use DanielSiepmann\Tracking\Dashboard\Provider\Recordviews;
|
||||||
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
||||||
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\Recordviews
|
* @covers \DanielSiepmann\Tracking\Dashboard\Provider\Recordviews
|
||||||
*/
|
*/
|
||||||
class RecordviewsTest extends TestCase
|
class RecordviewsTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
@ -53,7 +56,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function listsSixResultsForLast31DaysByDefault(): void
|
public function listsSixResultsForLast31DaysByDefault(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
|
@ -86,7 +89,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedOrdering(): void
|
public function respectedOrdering(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
'crdate' => time(),
|
'crdate' => time(),
|
||||||
|
@ -133,7 +136,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedNumberOfDays(): void
|
public function respectedNumberOfDays(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
'crdate' => strtotime('-3 days'),
|
'crdate' => strtotime('-3 days'),
|
||||||
|
@ -173,7 +176,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedMaxResults(): void
|
public function respectedMaxResults(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
|
@ -204,7 +207,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectedExcludedPages(): void
|
public function respectedExcludedPages(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
|
@ -240,7 +243,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function respectLimitesTables(): void
|
public function respectLimitesTables(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
for ($i = 1; $i <= 3; $i++) {
|
for ($i = 1; $i <= 3; $i++) {
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
|
@ -320,7 +323,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function localizedRecordTitlesIfLimitedToSingleLanguage(): void
|
public function localizedRecordTitlesIfLimitedToSingleLanguage(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
'crdate' => time(),
|
'crdate' => time(),
|
||||||
|
@ -368,7 +371,7 @@ class RecordviewsTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function defaultLanguageTitleIsUsedIfMultipleLanguagesAreAllowed(): void
|
public function defaultLanguageTitleIsUsedIfMultipleLanguagesAreAllowed(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/SysCategories.xml');
|
$this->importPHPDataSet(__DIR__ . '/../../Fixtures/SysCategories.php');
|
||||||
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_recordview');
|
||||||
$connection->insert('tx_tracking_recordview', [
|
$connection->insert('tx_tracking_recordview', [
|
||||||
'crdate' => time(),
|
'crdate' => time(),
|
||||||
|
|
24
Tests/Functional/Fixtures/BackendUser.php
Normal file
24
Tests/Functional/Fixtures/BackendUser.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'be_users' => [
|
||||||
|
[
|
||||||
|
'uid' => '1',
|
||||||
|
'pid' => '0',
|
||||||
|
'tstamp' => '1366642540',
|
||||||
|
'username' => 'admin',
|
||||||
|
'password' => '$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1',
|
||||||
|
'admin' => '1',
|
||||||
|
'disable' => '0',
|
||||||
|
'starttime' => '0',
|
||||||
|
'endtime' => '0',
|
||||||
|
'options' => '0',
|
||||||
|
'crdate' => '1366642540',
|
||||||
|
'workspace_perms' => '1',
|
||||||
|
'deleted' => '0',
|
||||||
|
'TSconfig' => 'NULL',
|
||||||
|
'lastlogin' => '1371033743',
|
||||||
|
'workspace_id' => '0',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,21 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<dataset>
|
|
||||||
<be_users>
|
|
||||||
<uid>1</uid>
|
|
||||||
<pid>0</pid>
|
|
||||||
<tstamp>1366642540</tstamp>
|
|
||||||
<username>admin</username>
|
|
||||||
<password>$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1</password> <!-- password -->
|
|
||||||
<admin>1</admin>
|
|
||||||
<disable>0</disable>
|
|
||||||
<starttime>0</starttime>
|
|
||||||
<endtime>0</endtime>
|
|
||||||
<options>0</options>
|
|
||||||
<crdate>1366642540</crdate>
|
|
||||||
<workspace_perms>1</workspace_perms>
|
|
||||||
<deleted>0</deleted>
|
|
||||||
<TSconfig>NULL</TSconfig>
|
|
||||||
<lastlogin>1371033743</lastlogin>
|
|
||||||
<workspace_id>0</workspace_id>
|
|
||||||
</be_users>
|
|
||||||
</dataset>
|
|
64
Tests/Functional/Fixtures/Pages.php
Normal file
64
Tests/Functional/Fixtures/Pages.php
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pages' => [
|
||||||
|
[
|
||||||
|
'pid' => '0',
|
||||||
|
'uid' => '1',
|
||||||
|
'title' => 'Page 1',
|
||||||
|
'slug' => '/',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '11',
|
||||||
|
'title' => 'Seite 1',
|
||||||
|
'l10n_parent' => '1',
|
||||||
|
'sys_language_uid' => '1',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '2',
|
||||||
|
'title' => 'Page 2',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '3',
|
||||||
|
'title' => 'Page 3',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '4',
|
||||||
|
'title' => 'Page 4',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '5',
|
||||||
|
'title' => 'Page 5',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '6',
|
||||||
|
'title' => 'Page 6',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '7',
|
||||||
|
'title' => 'Page 7',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '8',
|
||||||
|
'title' => 'Page 8',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '9',
|
||||||
|
'title' => 'Page 9',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '10',
|
||||||
|
'title' => 'Page 10',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,61 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<dataset>
|
|
||||||
<pages>
|
|
||||||
<pid>0</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
<title>Page 1</title>
|
|
||||||
<slug>/</slug>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>11</uid>
|
|
||||||
<title>Seite 1</title>
|
|
||||||
<l10n_parent>1</l10n_parent>
|
|
||||||
<sys_language_uid>1</sys_language_uid>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>2</uid>
|
|
||||||
<title>Page 2</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>3</uid>
|
|
||||||
<title>Page 3</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>4</uid>
|
|
||||||
<title>Page 4</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>5</uid>
|
|
||||||
<title>Page 5</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>6</uid>
|
|
||||||
<title>Page 6</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>7</uid>
|
|
||||||
<title>Page 7</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>8</uid>
|
|
||||||
<title>Page 8</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>9</uid>
|
|
||||||
<title>Page 9</title>
|
|
||||||
</pages>
|
|
||||||
<pages>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>10</uid>
|
|
||||||
<title>Page 10</title>
|
|
||||||
</pages>
|
|
||||||
</dataset>
|
|
52
Tests/Functional/Fixtures/SysCategories.php
Normal file
52
Tests/Functional/Fixtures/SysCategories.php
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'sys_category' => [
|
||||||
|
[
|
||||||
|
'uid' => '1',
|
||||||
|
'title' => 'Category 1',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '11',
|
||||||
|
'title' => 'Kategorie 1',
|
||||||
|
'l10n_parent' => '1',
|
||||||
|
'sys_language_uid' => '1',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '2',
|
||||||
|
'title' => 'Category 2',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '3',
|
||||||
|
'title' => 'Category 3',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '4',
|
||||||
|
'title' => 'Category 4',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '5',
|
||||||
|
'title' => 'Category 5',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '6',
|
||||||
|
'title' => 'Category 6',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '7',
|
||||||
|
'title' => 'Category 7',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '8',
|
||||||
|
'title' => 'Category 8',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '9',
|
||||||
|
'title' => 'Category 9',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'uid' => '10',
|
||||||
|
'title' => 'Category 10',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,49 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<dataset>
|
|
||||||
<sys_category>
|
|
||||||
<uid>1</uid>
|
|
||||||
<title>Category 1</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>11</uid>
|
|
||||||
<title>Kategorie 1</title>
|
|
||||||
<l10n_parent>1</l10n_parent>
|
|
||||||
<sys_language_uid>1</sys_language_uid>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>2</uid>
|
|
||||||
<title>Category 2</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>3</uid>
|
|
||||||
<title>Category 3</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>4</uid>
|
|
||||||
<title>Category 4</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>5</uid>
|
|
||||||
<title>Category 5</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>6</uid>
|
|
||||||
<title>Category 6</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>7</uid>
|
|
||||||
<title>Category 7</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>8</uid>
|
|
||||||
<title>Category 8</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>9</uid>
|
|
||||||
<title>Category 9</title>
|
|
||||||
</sys_category>
|
|
||||||
<sys_category>
|
|
||||||
<uid>10</uid>
|
|
||||||
<title>Category 10</title>
|
|
||||||
</sys_category>
|
|
||||||
</dataset>
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pages' => [
|
||||||
|
[
|
||||||
|
'pid' => '0',
|
||||||
|
'uid' => '1',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'tx_tracking_pageview' => [
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '1',
|
||||||
|
'url' => 'https://example.com/path',
|
||||||
|
'user_agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36',
|
||||||
|
'operating_system' => '',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'tx_tracking_recordview' => [
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '1',
|
||||||
|
'url' => 'https://example.com/path',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,20 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<dataset>
|
|
||||||
<pages>
|
|
||||||
<pid>0</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
</pages>
|
|
||||||
|
|
||||||
<tx_tracking_pageview>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
<url>https://example.com/path</url>
|
|
||||||
<user_agent>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36</user_agent>
|
|
||||||
<operating_system></operating_system>
|
|
||||||
</tx_tracking_pageview>
|
|
||||||
<tx_tracking_recordview>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
<url>https://example.com/path</url>
|
|
||||||
</tx_tracking_recordview>
|
|
||||||
</dataset>
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pages' => [
|
||||||
|
[
|
||||||
|
'pid' => '0',
|
||||||
|
'uid' => '1',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'tx_tracking_pageview' => [
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '1',
|
||||||
|
'url' => 'https://example.com/path',
|
||||||
|
'user_agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36',
|
||||||
|
'operating_system' => '',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '2',
|
||||||
|
'url' => 'https://example.com/path',
|
||||||
|
'user_agent' => 'Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A3003 Build/PKQ1.181203.001)',
|
||||||
|
'operating_system' => '',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<dataset>
|
|
||||||
<pages>
|
|
||||||
<pid>0</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
</pages>
|
|
||||||
|
|
||||||
<tx_tracking_pageview>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
<url>https://example.com/path</url>
|
|
||||||
<user_agent>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36</user_agent>
|
|
||||||
<operating_system></operating_system>
|
|
||||||
</tx_tracking_pageview>
|
|
||||||
<tx_tracking_pageview>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>2</uid>
|
|
||||||
<url>https://example.com/path</url>
|
|
||||||
<user_agent>Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A3003 Build/PKQ1.181203.001)</user_agent>
|
|
||||||
<operating_system></operating_system>
|
|
||||||
</tx_tracking_pageview>
|
|
||||||
</dataset>
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'pages' => [
|
||||||
|
[
|
||||||
|
'pid' => '0',
|
||||||
|
'uid' => '1',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'tx_tracking_pageview' => [
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '1',
|
||||||
|
'url' => 'https://example.com/path',
|
||||||
|
'user_agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36',
|
||||||
|
'operating_system' => 'Linux',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pid' => '1',
|
||||||
|
'uid' => '2',
|
||||||
|
'url' => 'https://example.com/path',
|
||||||
|
'user_agent' => 'Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A3003 Build/PKQ1.181203.001)',
|
||||||
|
'operating_system' => 'Android',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<dataset>
|
|
||||||
<pages>
|
|
||||||
<pid>0</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
</pages>
|
|
||||||
|
|
||||||
<tx_tracking_pageview>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>1</uid>
|
|
||||||
<url>https://example.com/path</url>
|
|
||||||
<user_agent>Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36</user_agent>
|
|
||||||
<operating_system>Linux</operating_system>
|
|
||||||
</tx_tracking_pageview>
|
|
||||||
<tx_tracking_pageview>
|
|
||||||
<pid>1</pid>
|
|
||||||
<uid>2</uid>
|
|
||||||
<url>https://example.com/path</url>
|
|
||||||
<user_agent>Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A3003 Build/PKQ1.181203.001)</user_agent>
|
|
||||||
<operating_system>Android</operating_system>
|
|
||||||
</tx_tracking_pageview>
|
|
||||||
</dataset>
|
|
|
@ -21,17 +21,20 @@ namespace DanielSiepmann\Tracking\Tests\Functional;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
||||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext;
|
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext;
|
||||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @testdox Pageviews are
|
* @testdox Pageviews are
|
||||||
*
|
*
|
||||||
* @coversNothing
|
* @coversNothing
|
||||||
*/
|
*/
|
||||||
class PageviewTest extends TestCase
|
class PageviewTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
@ -44,7 +47,7 @@ class PageviewTest extends TestCase
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/Fixtures/Pages.php');
|
||||||
$this->setUpFrontendRootPage(1, [
|
$this->setUpFrontendRootPage(1, [
|
||||||
'EXT:tracking/Tests/Functional/Fixtures/Rendering.typoscript',
|
'EXT:tracking/Tests/Functional/Fixtures/Rendering.typoscript',
|
||||||
]);
|
]);
|
||||||
|
@ -77,7 +80,7 @@ class PageviewTest extends TestCase
|
||||||
*/
|
*/
|
||||||
public function notTrackedWhenDisallowed(): void
|
public function notTrackedWhenDisallowed(): void
|
||||||
{
|
{
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/BackendUser.xml');
|
$this->importPHPDataSet(__DIR__ . '/Fixtures/BackendUser.php');
|
||||||
$this->setUpBackendUser(1);
|
$this->setUpBackendUser(1);
|
||||||
|
|
||||||
$request = new InternalRequest();
|
$request = new InternalRequest();
|
||||||
|
|
|
@ -21,16 +21,19 @@ namespace DanielSiepmann\Tracking\Tests\Functional;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
||||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @testdox Recordviews are
|
* @testdox Recordviews are
|
||||||
*
|
*
|
||||||
* @coversNothing
|
* @coversNothing
|
||||||
*/
|
*/
|
||||||
class RecordviewTest extends TestCase
|
class RecordviewTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
'typo3conf/ext/tracking/Tests/Functional/Fixtures/Extensions/recordview',
|
'typo3conf/ext/tracking/Tests/Functional/Fixtures/Extensions/recordview',
|
||||||
|
@ -52,7 +55,7 @@ class RecordviewTest extends TestCase
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
|
$this->importPHPDataSet(__DIR__ . '/Fixtures/Pages.php');
|
||||||
$this->setUpFrontendRootPage(1, [
|
$this->setUpFrontendRootPage(1, [
|
||||||
'EXT:tracking/Tests/Functional/Fixtures/Rendering.typoscript',
|
'EXT:tracking/Tests/Functional/Fixtures/Rendering.typoscript',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -21,9 +21,10 @@ namespace DanielSiepmann\Tracking\Tests\Functional;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Codappix\Typo3PhpDatasets\TestingFramework;
|
||||||
use TYPO3\CMS\Core\DataHandling\DataHandler;
|
use TYPO3\CMS\Core\DataHandling\DataHandler;
|
||||||
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
|
||||||
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
||||||
use UnexpectedValueException;
|
use UnexpectedValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,8 +32,10 @@ use UnexpectedValueException;
|
||||||
*
|
*
|
||||||
* @testdox This extension works with TYPO3 feature:
|
* @testdox This extension works with TYPO3 feature:
|
||||||
*/
|
*/
|
||||||
class Typo3FeaturesTest extends TestCase
|
class Typo3FeaturesTest extends FunctionalTestCase
|
||||||
{
|
{
|
||||||
|
use TestingFramework;
|
||||||
|
|
||||||
protected array $testExtensionsToLoad = [
|
protected array $testExtensionsToLoad = [
|
||||||
'typo3conf/ext/tracking',
|
'typo3conf/ext/tracking',
|
||||||
];
|
];
|
||||||
|
@ -41,8 +44,8 @@ class Typo3FeaturesTest extends TestCase
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/BackendUser.xml');
|
$this->importPHPDataSet(__DIR__ . '/Fixtures/BackendUser.php');
|
||||||
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Typo3FeaturesTest/PageWithRecords.xml');
|
$this->importPHPDataSet(__DIR__ . '/Fixtures/Typo3FeaturesTest/PageWithRecords.php');
|
||||||
$this->setUpBackendUser(1);
|
$this->setUpBackendUser(1);
|
||||||
$languageServiceFactory = $this->getContainer()->get(LanguageServiceFactory::class);
|
$languageServiceFactory = $this->getContainer()->get(LanguageServiceFactory::class);
|
||||||
if (!$languageServiceFactory instanceof LanguageServiceFactory) {
|
if (!$languageServiceFactory instanceof LanguageServiceFactory) {
|
||||||
|
|
|
@ -24,12 +24,12 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
|
||||||
use DanielSiepmann\Tracking\Domain\Model\Extractor;
|
use DanielSiepmann\Tracking\Domain\Model\Extractor;
|
||||||
use DanielSiepmann\Tracking\Domain\Model\HasUserAgent;
|
use DanielSiepmann\Tracking\Domain\Model\HasUserAgent;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Domain\Model\Extractor
|
* @covers \DanielSiepmann\Tracking\Domain\Model\Extractor
|
||||||
*/
|
*/
|
||||||
class ExtractorTest extends TestCase
|
class ExtractorTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ use DanielSiepmann\Tracking\Domain\Model\Pageview;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
||||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Domain\Model\Pageview
|
* @covers \DanielSiepmann\Tracking\Domain\Model\Pageview
|
||||||
*/
|
*/
|
||||||
class PageviewTest extends TestCase
|
class PageviewTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use DanielSiepmann\Tracking\Domain\Model\RecordRule;
|
use DanielSiepmann\Tracking\Domain\Model\RecordRule;
|
||||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Domain\Model\RecordRule
|
* @covers \DanielSiepmann\Tracking\Domain\Model\RecordRule
|
||||||
*/
|
*/
|
||||||
class RecordRuleTest extends TestCase
|
class RecordRuleTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
|
|
|
@ -25,12 +25,12 @@ use DanielSiepmann\Tracking\Domain\Model\Recordview;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
||||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Domain\Model\Recordview
|
* @covers \DanielSiepmann\Tracking\Domain\Model\Recordview
|
||||||
*/
|
*/
|
||||||
class RecordviewTest extends TestCase
|
class RecordviewTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,12 @@ use TYPO3\CMS\Core\Routing\PageArguments;
|
||||||
use TYPO3\CMS\Core\Site\Entity\Site;
|
use TYPO3\CMS\Core\Site\Entity\Site;
|
||||||
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
||||||
use TYPO3\CMS\Core\Site\SiteFinder;
|
use TYPO3\CMS\Core\Site\SiteFinder;
|
||||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Domain\Pageview\Factory
|
* @covers \DanielSiepmann\Tracking\Domain\Pageview\Factory
|
||||||
*/
|
*/
|
||||||
class FactoryTest extends TestCase
|
class FactoryTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,12 @@ use DateTimeImmutable;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use TYPO3\CMS\Core\Database\Connection;
|
use TYPO3\CMS\Core\Database\Connection;
|
||||||
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
||||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Domain\Repository\Pageview
|
* @covers \DanielSiepmann\Tracking\Domain\Repository\Pageview
|
||||||
*/
|
*/
|
||||||
class PageviewTest extends TestCase
|
class PageviewTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,12 @@ use DateTimeImmutable;
|
||||||
use Prophecy\PhpUnit\ProphecyTrait;
|
use Prophecy\PhpUnit\ProphecyTrait;
|
||||||
use TYPO3\CMS\Core\Database\Connection;
|
use TYPO3\CMS\Core\Database\Connection;
|
||||||
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
|
||||||
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \DanielSiepmann\Tracking\Domain\Repository\Recordview
|
* @covers \DanielSiepmann\Tracking\Domain\Repository\Recordview
|
||||||
*/
|
*/
|
||||||
class RecordviewTest extends TestCase
|
class RecordviewTest extends UnitTestCase
|
||||||
{
|
{
|
||||||
use ProphecyTrait;
|
use ProphecyTrait;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
"typo3/cms-dashboard": "^11.5 || ^12.4"
|
"typo3/cms-dashboard": "^11.5 || ^12.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"codappix/typo3-php-datasets": "^1.3",
|
||||||
"cweagans/composer-patches": "^1.7",
|
"cweagans/composer-patches": "^1.7",
|
||||||
"friendsofphp/php-cs-fixer": "^3.14",
|
"friendsofphp/php-cs-fixer": "^3.14",
|
||||||
"jangregor/phpstan-prophecy": "^1.0",
|
"jangregor/phpstan-prophecy": "^1.0",
|
||||||
|
|
Loading…
Reference in a new issue