Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: PHP lint
Expand All @@ -44,6 +45,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -84,6 +86,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -117,6 +120,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "7.4"

- name: Install xmllint
Expand Down Expand Up @@ -154,6 +158,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "7.4"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -191,6 +196,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -232,6 +238,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -272,6 +279,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -322,6 +330,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -354,6 +363,44 @@ jobs:
export typo3DatabasePassword="root"
./vendor/bin/phpunit --testdox

mutationtesting:
runs-on: ubuntu-latest
needs:
- tests-sqlite-TYPO3-v10
strategy:
matrix:
php-version:
- '7.4'
typo3-version:
- '^10.4'
steps:
- uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
coverage: pcov
ini-values: pcov.directory=Classes

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Mutation Testing
run: ./vendor/bin/infection --show-mutations --min-msi=100 --min-covered-msi=100 --no-progress -j$(nproc)

code-quality-TYPO3-v10:
runs-on: ubuntu-latest
needs:
Expand All @@ -370,6 +417,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down Expand Up @@ -410,6 +458,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"

- name: Get Composer Cache Directory
Expand Down
33 changes: 33 additions & 0 deletions Tests/Functional/Dashboard/Provider/PageviewsPerPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,37 @@ public function defaultLanguageTitleIsUsedIfMultipleLanguagesAreAllowed(): void
], $result['labels']);
static::assertCount(3, $result['datasets'][0]['data']);
}

/**
* @test
*/
public function shortensTitleBasedOnUserSettings(): void
{
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/Pages.xml');
$this->importDataSet('EXT:tracking/Tests/Functional/Fixtures/BackendUserWithTitleLen.xml');
$this->setUpBackendUser(10);
$connection = $this->getConnectionPool()->getConnectionForTable('tx_tracking_pageview');
for ($i = 1; $i <= 10; $i++) {
$connection->insert('tx_tracking_pageview', [
'pid' => $i,
'crdate' => time(),
]);
}

$subject = new PageviewsPerPage(
GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_tracking_pageview'),
GeneralUtility::makeInstance(PageRepository::class)
);

$result = $subject->getChartData();
static::assertSame([
'Page...',
'Page...',
'Page...',
'Page...',
'Page...',
'Page...',
], $result['labels']);
static::assertCount(6, $result['datasets'][0]['data']);
}
}
23 changes: 23 additions & 0 deletions Tests/Functional/Fixtures/BackendUserWithTitleLen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<be_users>
<uid>10</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>
<cruser_id>0</cruser_id>
<workspace_perms>1</workspace_perms>
<deleted>0</deleted>
<TSconfig>NULL</TSconfig>
<lastlogin>1371033743</lastlogin>
<workspace_id>0</workspace_id>
<uc>a:1:{s:8:"titleLen";i:4;}</uc>
</be_users>
</dataset>
4 changes: 3 additions & 1 deletion Tests/Unit/Domain/Repository/PageviewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function modelCanBeAdded(): void
/**
* @test
*/
public function throwsExceptionIfModelToUodateHasNoUid(): void
public function throwsExceptionIfModelToUpdateHasNoUid(): void
{
$connection = $this->prophesize(Connection::class);
$factory = $this->prophesize(Factory::class);
Expand All @@ -91,7 +91,9 @@ public function throwsExceptionIfModelToUodateHasNoUid(): void
$model->getUid()->willReturn(0);

$subject = new Pageview($connection->reveal(), $factory->reveal());
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Can not update pageview if uid is 0.');
$this->expectExceptionCode(1585770573);
$subject->update($model->reveal());
}

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"phpspec/prophecy-phpunit": "^2.0",
"typo3/testing-framework": "^6.8.2",
"saschaegerer/phpstan-typo3": "^0.13.1",
"symplify/easy-coding-standard": "^9.3"
"symplify/easy-coding-standard": "^9.3",
"infection/infection": "^0.23.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
24 changes: 24 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"source": {
"directories": [
"Classes"
]
},
"logs": {
"text": ".Build\/infection"
},
"mutators": {
"@default": true,
"CastArray": false,
"CastBool": false,
"CastFloat": false,
"CastInt": false,
"CastObject": false,
"CastString": false,
"MBString": {
"settings": {
"mb_stripos": false
}
}
}
}
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="default"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
Expand Down