!!!|Add acceptance tests for TYPO3 Backend and PHP 8.x (#107)

This commit is contained in:
Daniel Siepmann 2023-01-31 07:51:13 +01:00 committed by GitHub
parent 6f98b353fe
commit 2bf18536cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 390 additions and 16 deletions

View file

@ -15,11 +15,10 @@ jobs:
strategy: strategy:
matrix: matrix:
php-version: php-version:
- 7.2
- 7.3
- 7.4 - 7.4
- 8.0 - 8.0
- 8.1 - 8.1
- 8.2
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -87,10 +86,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- php-version: '7.2'
typo3-version: '^10.4'
- php-version: '7.3'
typo3-version: '^10.4'
- php-version: '7.4' - php-version: '7.4'
typo3-version: '^10.4' typo3-version: '^10.4'
- php-version: '7.4' - php-version: '7.4'
@ -99,6 +94,8 @@ jobs:
typo3-version: '^11.5' typo3-version: '^11.5'
- php-version: '8.1' - php-version: '8.1'
typo3-version: '^11.5' typo3-version: '^11.5'
- php-version: '8.2'
typo3-version: '^11.5'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -109,7 +106,9 @@ jobs:
tools: composer:v2 tools: composer:v2
- name: Install dependencies with expected TYPO3 version - name: Install dependencies with expected TYPO3 version
run: composer require --no-interaction --prefer-dist --no-progress "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" "typo3/cms-fluid-styled-content:${{ matrix.typo3-version }}" run: |-
composer require --no-interaction --prefer-dist --no-progress "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" "typo3/cms-fluid-styled-content:${{ matrix.typo3-version }}"
./vendor/bin/codecept build
- name: Code Quality (by PHPStan) - name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse run: ./vendor/bin/phpstan analyse
@ -122,12 +121,6 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- php-version: '7.2'
typo3-version: '^10.4'
db-version: '5.6'
- php-version: '7.3'
typo3-version: '^10.4'
db-version: '5.6'
- php-version: '7.4' - php-version: '7.4'
typo3-version: '^10.4' typo3-version: '^10.4'
db-version: '5.6' db-version: '5.6'
@ -143,6 +136,9 @@ jobs:
- php-version: '8.1' - php-version: '8.1'
typo3-version: '^11.5' typo3-version: '^11.5'
db-version: '8' db-version: '8'
- php-version: '8.2'
typo3-version: '^11.5'
db-version: '8'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -170,3 +166,15 @@ jobs:
export typo3DatabaseUsername="root" export typo3DatabaseUsername="root"
export typo3DatabasePassword="root" export typo3DatabasePassword="root"
./vendor/bin/phpunit --testdox ./vendor/bin/phpunit --testdox
tests-acceptance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run Acceptance Tests
run: nix-shell --run project-test-acceptance

View file

@ -1,4 +1,4 @@
1.3.0 2.0.0
===== =====
Breaking Breaking
@ -8,10 +8,12 @@ Breaking
The modules got new identifiers. User permissions need to be adjusted. The modules got new identifiers. User permissions need to be adjusted.
An update wizard is provided that will migrate the permissions. An update wizard is provided that will migrate the permissions.
* Drop support for PHP 7.2 + 7.3.
Features Features
-------- --------
* Add support for TYPO3 v11 and PHP 8.0 + 8.1. * Add support for TYPO3 v11 and PHP 8.0 + 8.1 + 8.2.
* Last import date is now shown within backend module beside each import configuration. * Last import date is now shown within backend module beside each import configuration.
@ -108,6 +110,8 @@ Tasks
Provide new icon for storage folders. Provide new icon for storage folders.
Provide new icon for content element. Provide new icon for content element.
* Add first acceptance tests for backend modules.
Deprecation Deprecation
----------- -----------

View file

@ -0,0 +1,70 @@
<?php
declare(strict_types=1);
/*
* Copyright (C) 2023 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace WerkraumMedia\ThueCat\Tests\Acceptance;
use WerkraumMedia\ThueCat\Tests\Acceptance\Support\AcceptanceTester;
class BackendConfigurationCest
{
public function _before(AcceptanceTester $I): void
{
$I->amOnPage('/typo3');
$I->submitForm('#typo3-login-form', [
'username' => 'admin',
'p_field' => 'password',
]);
$I->waitForText('New TYPO3 site');
}
public function showsIndex(AcceptanceTester $I): void
{
$I->click('Configurations');
$I->switchToContentFrame();
$I->see('ThüCAT - Configurations');
$I->see('Example Configuration');
$I->see('Please provide an import configuration and trigger import to create an organisation.');
}
public function allowsToImportExistingConfiguration(AcceptanceTester $I): void
{
$I->click('Configurations');
$I->switchToContentFrame();
$I->see('Example Configuration');
$I->see('Never');
$I->click('Import based on import configuration');
$I->see('Import finished');
$I->see('Imported configuration "Example Configuration".');
$I->see('Tourist-Information Schmalkalden');
}
public function showsExecutedImport(AcceptanceTester $I): void
{
$I->click('Imports');
$I->switchToContentFrame();
$I->see('ThüCAT - Imports');
$I->see('Example Configuration');
}
}

View file

View file

@ -0,0 +1,45 @@
pages
,uid,pid,doktype,slug,title
,1,0,4,/,Rootpage
,2,1,255,/storage,Storage
tx_thuecat_import_configuration
,uid,pid,title,type,configuration
,1,2,"Example Configuration",static,"<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes"" ?><T3FlexForms>
<data>
<sheet index=""sDEF"">
<language index=""lDEF"">
<field index=""storagePid"">
<value index=""vDEF"">2</value>
</field>
<field index=""urls"">
<el index=""el"">
<field index=""633554a57c83b383375701"">
<value index=""url"">
<el>
<field index=""url"">
<value index=""vDEF"">https://thuecat.org/resources/644315157726-jmww</value>
</field>
</el>
</value>
<value index=""_TOGGLE"">0</value>
</field>
<field index=""633551f49acee985442403"">
<value index=""url"">
<el>
<field index=""url"">
<value index=""vDEF"">https://thuecat.org/resources/072778761562-kwah</value>
</field>
</el>
</value>
<value index=""_TOGGLE"">0</value>
</field>
</el>
</field>
</language>
</sheet>
</data>
</T3FlexForms>",
"be_users"
,"uid","pid","tstamp","username","password","admin","disable","starttime","endtime","options","crdate","workspace_perms","deleted","TSconfig","lastlogin","workspace_id","db_mountpoints","usergroup","realName"
# password is "password"
,1,0,1366642540,"admin","$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1",1,0,0,0,0,1366642540,1,0,,1371033743,0,0,0,"Klaus Admin"
Can't render this file because it has a wrong number of fields in line 2.

View file

@ -0,0 +1,47 @@
base: 'http://localhost:8080'
languages:
-
title: Deutsch
enabled: true
base: /
typo3Language: de
locale: de_DE.UTF-8
iso-639-1: de
navigationTitle: Deutsch
hreflang: de-DE
direction: ''
flag: de
websiteTitle: ''
languageId: 0
-
title: English
enabled: true
base: /en
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
websiteTitle: ''
navigationTitle: English
hreflang: en-GB
direction: ''
flag: gb
languageId: 1
fallbackType: strict
fallbacks: '0'
-
title: French
enabled: true
base: /fr/
typo3Language: fr
locale: fr_FR.ytf8
iso-639-1: fr
websiteTitle: ''
navigationTitle: ''
hreflang: fr-FR
direction: ''
fallbackType: strict
fallbacks: '1,0'
flag: fr
languageId: 2
rootPageId: 1
websiteTitle: 'Example Website'

View file

@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
/*
* Copyright (C) 2023 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace WerkraumMedia\ThueCat\Tests\Acceptance\Support;
use Codeception\Actor;
use TYPO3\TestingFramework\Core\Acceptance\Step\FrameSteps;
use WerkraumMedia\ThueCat\Tests\Acceptance\Support\_generated\AcceptanceTesterActions;
/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method void pause()
*
* @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends Actor
{
use FrameSteps;
use AcceptanceTesterActions;
/**
* Define custom actions here
*/
}

View file

@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
/*
* Copyright (C) 2023 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace WerkraumMedia\ThueCat\Tests\Acceptance\Support;
use TYPO3\TestingFramework\Core\Acceptance\Extension\BackendEnvironment;
/**
* Load various core extensions and extension under test.
*/
class Environment extends BackendEnvironment
{
protected $localConfig = [
'coreExtensionsToLoad' => [
'install',
'core',
'backend',
'extbase',
'frontend',
'fluid',
],
'testExtensionsToLoad' => [
'typo3conf/ext/thuecat',
],
'csvDatabaseFixtures' => [
__DIR__ . '/../Data/BasicDatabase.csv',
],
'pathsToLinkInTestInstance' => [
'/../../../../../../Tests/Acceptance/Data/Sites/' => 'typo3conf/sites',
],
];
}

View file

@ -0,0 +1,2 @@
*
!.gitignore

2
Tests/Acceptance/_output/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

44
codeception.dist.yml Normal file
View file

@ -0,0 +1,44 @@
namespace: 'WerkraumMedia\ThueCat\Tests\Acceptance\Support'
paths:
tests: 'Tests/Acceptance'
data: 'Tests/Acceptance/Data'
output: '.Build/web/typo3temp/var/tests/AcceptanceReports'
support: 'Tests/Acceptance/Support'
settings:
debug: true
extensions:
enabled:
- 'Codeception\Extension\RunFailed'
suites:
acceptance:
actor: 'AcceptanceTester'
path: .
extensions:
enabled:
- 'Codeception\Extension\RunProcess':
- 'geckodriver > .Build/web/typo3temp/var/tests/AcceptanceReports/geckodriver.log 2>&1'
- 'TYPO3_PATH_APP="$INSTANCE_PATH" TYPO3_PATH_ROOT="$INSTANCE_PATH" php -S 127.0.0.1:8080 -t "$INSTANCE_PATH" > .Build/web/typo3temp/var/tests/AcceptanceReports/php.log 2>&1'
- 'WerkraumMedia\ThueCat\Tests\Acceptance\Support\Environment':
'typo3DatabaseUsername': 'testing'
'typo3DatabasePassword': 'testing'
modules:
enabled:
- WebDriver:
url: 'http://localhost:8080'
browser: 'firefox'
restart: true
path: ''
wait: 5
capabilities:
moz:firefoxOptions:
args:
- '-headless'
- '\TYPO3\TestingFramework\Core\Acceptance\Helper\Acceptance'
step_decorators:
- 'Codeception\Step\Retry'

View file

@ -35,7 +35,7 @@
} }
}, },
"require": { "require": {
"php": "~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0", "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"psr/http-client": "^1.0", "psr/http-client": "^1.0",
@ -54,6 +54,8 @@
"typo3/cms-frontend": "^10.4 || ^11.5" "typo3/cms-frontend": "^10.4 || ^11.5"
}, },
"require-dev": { "require-dev": {
"codeception/codeception": "^4.2",
"codeception/module-webdriver": "^2.0",
"jangregor/phpstan-prophecy": "^1.0", "jangregor/phpstan-prophecy": "^1.0",
"phpstan/extension-installer": "^1.1", "phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "1.1.0", "phpstan/phpstan": "1.1.0",

View file

@ -6,6 +6,8 @@ parameters:
- Classes - Classes
- Configuration - Configuration
- Tests - Tests
excludePaths:
- Tests/Acceptance/Support/_generated/
checkMissingIterableValueType: false checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: false reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false checkGenericClassInNonGenericObjectType: false

43
shell.nix Normal file
View file

@ -0,0 +1,43 @@
{ pkgs ? import <nixpkgs> { } }:
let
projectInstall = pkgs.writeShellApplication {
name = "project-install";
runtimeInputs = [
pkgs.php82
pkgs.php82Packages.composer
];
text = ''
composer install --prefer-dist --no-progress --working-dir="$PROJECT_ROOT"
'';
};
projectTestAcceptance = pkgs.writeShellApplication {
name = "project-test-acceptance";
runtimeInputs = [
projectInstall
pkgs.sqlite
pkgs.firefox
pkgs.geckodriver
pkgs.php82
];
text = ''
project-install
export INSTANCE_PATH="$PROJECT_ROOT/.Build/web/typo3temp/var/tests/acceptance"
export typo3DatabaseDriver=pdo_sqlite
mkdir -p "$INSTANCE_PATH"
./vendor/bin/codecept run
'';
};
in pkgs.mkShell {
name = "TYPO3 Extension ThüCAT";
buildInputs = [
projectTestAcceptance
];
shellHook = ''
export PROJECT_ROOT="$(pwd)"
'';
}