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:
Daniel Siepmann 2023-05-11 08:48:15 +02:00
parent bbeeea7f5c
commit 38a2be296a
30 changed files with 307 additions and 257 deletions

View file

@ -25,6 +25,8 @@ Tasks
* Make sql within tests on CI more robust.
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
-----------

View file

@ -21,16 +21,19 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Command;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
use DanielSiepmann\Tracking\Command\UpdateDataCommand;
use Symfony\Component\Console\Tester\CommandTester;
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
*/
class UpdateDataCommandTest extends TestCase
class UpdateDataCommandTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
];
@ -44,7 +47,7 @@ class UpdateDataCommandTest extends TestCase
*/
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);
$tester = new CommandTester($subject);
@ -63,7 +66,7 @@ class UpdateDataCommandTest extends TestCase
*/
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);
$tester = new CommandTester($subject);
@ -82,7 +85,7 @@ class UpdateDataCommandTest extends TestCase
*/
public function doesNothingIfNoRecordExists(): void
{
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
$this->importPHPDataSet(__DIR__ . '/../Fixtures/Pages.php');
$subject = GeneralUtility::makeInstance(UpdateDataCommand::class);
$tester = new CommandTester($subject);

View file

@ -24,12 +24,12 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
use DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews;
use TYPO3\CMS\Core\Database\ConnectionPool;
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
*/
class NewestPageviewsTest extends TestCase
class NewestPageviewsTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',

View file

@ -21,17 +21,20 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerDay;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
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
*/
class PageviewsPerDayTest extends TestCase
class PageviewsPerDayTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
];
@ -75,7 +78,7 @@ class PageviewsPerDayTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [
@ -104,7 +107,7 @@ class PageviewsPerDayTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [
@ -134,7 +137,7 @@ class PageviewsPerDayTest extends TestCase
*/
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');
$subject = new PageviewsPerDay(

View file

@ -21,16 +21,19 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerOperatingSystem;
use TYPO3\CMS\Core\Database\ConnectionPool;
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
*/
class PageviewsPerOperatingSystemTest extends TestCase
class PageviewsPerOperatingSystemTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
];
@ -70,7 +73,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
*/
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->insert('tx_tracking_pageview', [
'pid' => 1,
@ -111,7 +114,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
*/
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->insert('tx_tracking_pageview', [
'pid' => 1,
@ -147,7 +150,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [
@ -178,7 +181,7 @@ class PageviewsPerOperatingSystemTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [

View file

@ -21,18 +21,21 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
use DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
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
*/
class PageviewsPerPageTest extends TestCase
class PageviewsPerPageTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
];
@ -54,7 +57,7 @@ class PageviewsPerPageTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [
@ -85,7 +88,7 @@ class PageviewsPerPageTest extends TestCase
*/
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->insert('tx_tracking_pageview', [
'pid' => 1,
@ -123,7 +126,7 @@ class PageviewsPerPageTest extends TestCase
*/
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->insert('tx_tracking_pageview', [
'pid' => 1,
@ -157,7 +160,7 @@ class PageviewsPerPageTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [
@ -188,7 +191,7 @@ class PageviewsPerPageTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [
@ -220,7 +223,7 @@ class PageviewsPerPageTest extends TestCase
*/
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->insert('tx_tracking_pageview', [
'pid' => 1,
@ -267,7 +270,7 @@ class PageviewsPerPageTest extends TestCase
*/
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->insert('tx_tracking_pageview', [
'pid' => 1,

View file

@ -21,17 +21,20 @@ namespace DanielSiepmann\Tracking\Tests\Functional\Dashboard\Provider;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
use DanielSiepmann\Tracking\Dashboard\Provider\Recordviews;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
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
*/
class RecordviewsTest extends TestCase
class RecordviewsTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
];
@ -53,7 +56,7 @@ class RecordviewsTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_recordview', [
@ -86,7 +89,7 @@ class RecordviewsTest extends TestCase
*/
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->insert('tx_tracking_recordview', [
'crdate' => time(),
@ -133,7 +136,7 @@ class RecordviewsTest extends TestCase
*/
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->insert('tx_tracking_recordview', [
'crdate' => strtotime('-3 days'),
@ -173,7 +176,7 @@ class RecordviewsTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_recordview', [
@ -204,7 +207,7 @@ class RecordviewsTest extends TestCase
*/
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');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_recordview', [
@ -240,7 +243,7 @@ class RecordviewsTest extends TestCase
*/
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');
for ($i = 1; $i <= 3; $i++) {
$connection->insert('tx_tracking_recordview', [
@ -320,7 +323,7 @@ class RecordviewsTest extends TestCase
*/
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->insert('tx_tracking_recordview', [
'crdate' => time(),
@ -368,7 +371,7 @@ class RecordviewsTest extends TestCase
*/
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->insert('tx_tracking_recordview', [
'crdate' => time(),

View 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',
],
],
];

View file

@ -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>

View 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',
],
],
];

View file

@ -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>

View 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',
],
],
];

View file

@ -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>

View file

@ -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',
],
],
];

View file

@ -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>

View file

@ -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' => '',
],
],
];

View file

@ -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>

View file

@ -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',
],
],
];

View file

@ -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>

View file

@ -21,17 +21,20 @@ namespace DanielSiepmann\Tracking\Tests\Functional;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
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
*
* @coversNothing
*/
class PageviewTest extends TestCase
class PageviewTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
];
@ -44,7 +47,7 @@ class PageviewTest extends TestCase
{
parent::setUp();
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Pages.php');
$this->setUpFrontendRootPage(1, [
'EXT:tracking/Tests/Functional/Fixtures/Rendering.typoscript',
]);
@ -77,7 +80,7 @@ class PageviewTest extends TestCase
*/
public function notTrackedWhenDisallowed(): void
{
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/BackendUser.xml');
$this->importPHPDataSet(__DIR__ . '/Fixtures/BackendUser.php');
$this->setUpBackendUser(1);
$request = new InternalRequest();

View file

@ -21,16 +21,19 @@ namespace DanielSiepmann\Tracking\Tests\Functional;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
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
*
* @coversNothing
*/
class RecordviewTest extends TestCase
class RecordviewTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
'typo3conf/ext/tracking/Tests/Functional/Fixtures/Extensions/recordview',
@ -52,7 +55,7 @@ class RecordviewTest extends TestCase
{
parent::setUp();
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Pages.php');
$this->setUpFrontendRootPage(1, [
'EXT:tracking/Tests/Functional/Fixtures/Rendering.typoscript',
]);

View file

@ -21,9 +21,10 @@ namespace DanielSiepmann\Tracking\Tests\Functional;
* 02110-1301, USA.
*/
use Codappix\Typo3PhpDatasets\TestingFramework;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase as TestCase;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
use UnexpectedValueException;
/**
@ -31,8 +32,10 @@ use UnexpectedValueException;
*
* @testdox This extension works with TYPO3 feature:
*/
class Typo3FeaturesTest extends TestCase
class Typo3FeaturesTest extends FunctionalTestCase
{
use TestingFramework;
protected array $testExtensionsToLoad = [
'typo3conf/ext/tracking',
];
@ -41,8 +44,8 @@ class Typo3FeaturesTest extends TestCase
{
parent::setUp();
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/BackendUser.xml');
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Typo3FeaturesTest/PageWithRecords.xml');
$this->importPHPDataSet(__DIR__ . '/Fixtures/BackendUser.php');
$this->importPHPDataSet(__DIR__ . '/Fixtures/Typo3FeaturesTest/PageWithRecords.php');
$this->setUpBackendUser(1);
$languageServiceFactory = $this->getContainer()->get(LanguageServiceFactory::class);
if (!$languageServiceFactory instanceof LanguageServiceFactory) {

View file

@ -24,12 +24,12 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
use DanielSiepmann\Tracking\Domain\Model\Extractor;
use DanielSiepmann\Tracking\Domain\Model\HasUserAgent;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* @covers \DanielSiepmann\Tracking\Domain\Model\Extractor
*/
class ExtractorTest extends TestCase
class ExtractorTest extends UnitTestCase
{
use ProphecyTrait;

View file

@ -25,12 +25,12 @@ use DanielSiepmann\Tracking\Domain\Model\Pageview;
use DateTimeImmutable;
use Prophecy\PhpUnit\ProphecyTrait;
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
*/
class PageviewTest extends TestCase
class PageviewTest extends UnitTestCase
{
use ProphecyTrait;

View file

@ -22,12 +22,12 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
*/
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
*/
class RecordRuleTest extends TestCase
class RecordRuleTest extends UnitTestCase
{
/**
* @test

View file

@ -25,12 +25,12 @@ use DanielSiepmann\Tracking\Domain\Model\Recordview;
use DateTimeImmutable;
use Prophecy\PhpUnit\ProphecyTrait;
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
*/
class RecordviewTest extends TestCase
class RecordviewTest extends UnitTestCase
{
use ProphecyTrait;

View file

@ -30,12 +30,12 @@ use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
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
*/
class FactoryTest extends TestCase
class FactoryTest extends UnitTestCase
{
use ProphecyTrait;

View file

@ -28,12 +28,12 @@ use DateTimeImmutable;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Database\Connection;
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
*/
class PageviewTest extends TestCase
class PageviewTest extends UnitTestCase
{
use ProphecyTrait;

View file

@ -27,12 +27,12 @@ use DateTimeImmutable;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Database\Connection;
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
*/
class RecordviewTest extends TestCase
class RecordviewTest extends UnitTestCase
{
use ProphecyTrait;

View file

@ -39,6 +39,7 @@
"typo3/cms-dashboard": "^11.5 || ^12.4"
},
"require-dev": {
"codappix/typo3-php-datasets": "^1.3",
"cweagans/composer-patches": "^1.7",
"friendsofphp/php-cs-fixer": "^3.14",
"jangregor/phpstan-prophecy": "^1.0",