mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-09-08 02:36:12 +02:00
Compare commits
46 commits
f28c1a3b4c
...
e8531cad58
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e8531cad58 | ||
![]() |
37602a09a2 | ||
![]() |
4ae05422dc | ||
![]() |
863d7222f9 | ||
![]() |
e827f63eeb | ||
![]() |
a917dba5f2 | ||
![]() |
c3dc33a280 | ||
![]() |
7caa733038 | ||
![]() |
5b4337fd01 | ||
![]() |
395281c299 | ||
![]() |
7bbf2a98c6 | ||
![]() |
b0f0450fe1 | ||
![]() |
fe6f4539bf | ||
![]() |
76055e3aaf | ||
![]() |
674a1a86a4 | ||
![]() |
ce76e80ba2 | ||
![]() |
872027dd2f | ||
![]() |
2dd88cd800 | ||
![]() |
f8057b7cca | ||
![]() |
079b0b30af | ||
![]() |
8dad7bd5ca | ||
![]() |
072475abc1 | ||
![]() |
ae90800c25 | ||
![]() |
47483fc882 | ||
![]() |
279188d38c | ||
![]() |
75143a2de0 | ||
![]() |
bf6c49a313 | ||
![]() |
688fbbf6c6 | ||
8508d9ee1a | |||
d9347c174c | |||
![]() |
234251eaea | ||
![]() |
8cab4f7165 | ||
![]() |
f3cf612493 | ||
![]() |
f4d460ce63 | ||
![]() |
0f9e2c7c27 | ||
![]() |
e1f4257927 | ||
![]() |
b7d303a65e | ||
![]() |
2b16e5b37b | ||
![]() |
e9f3e7b744 | ||
![]() |
bbb8a9fc86 | ||
![]() |
dc04824b4c | ||
![]() |
0928b386dc | ||
![]() |
3064c2567b | ||
![]() |
20ca25086b | ||
![]() |
9d84ddd752 | ||
![]() |
0f9770c967 |
20 changed files with 5175 additions and 39 deletions
3
.gitattributes
vendored
3
.gitattributes
vendored
|
@ -5,6 +5,8 @@
|
|||
/.github/ export-ignore
|
||||
/.gitignore export-ignore
|
||||
/.gitlab/ export-ignore
|
||||
/.npmrc export-ignore
|
||||
/.nvmrc export-ignore
|
||||
/.php-cs-fixer.php export-ignore
|
||||
/.phpstorm.meta.php export-ignore
|
||||
/.prettierrc.js export-ignore
|
||||
|
@ -13,6 +15,7 @@
|
|||
/Configuration/UnitTests.xml export-ignore
|
||||
/Tests/ export-ignore
|
||||
/eslint.config.json export-ignore
|
||||
/package-lock.json export-ignore
|
||||
/package.json export-ignore
|
||||
/phive.xml export-ignore
|
||||
/phpcs.xml export-ignore
|
||||
|
|
2
.github/workflows/auto-approve.yml
vendored
2
.github/workflows/auto-approve.yml
vendored
|
@ -11,7 +11,7 @@ jobs:
|
|||
auto-approve:
|
||||
name: Dependabot auto-approve
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||
|
||||
|
|
2
.github/workflows/auto-merge.yml
vendored
2
.github/workflows/auto-merge.yml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
|||
auto-merge:
|
||||
name: Dependabot auto-merge
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||
|
||||
|
|
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
|
@ -14,7 +14,7 @@ permissions:
|
|||
jobs:
|
||||
php-lint:
|
||||
name: "PHP linter"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
|
@ -40,7 +40,7 @@ jobs:
|
|||
- "8.3"
|
||||
code-quality:
|
||||
name: "Code quality checks"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
|
@ -82,7 +82,7 @@ jobs:
|
|||
- "8.3"
|
||||
code-quality-frontend:
|
||||
name: "Code quality frontend checks"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -92,13 +92,19 @@ jobs:
|
|||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
- name: "Set up Node.js"
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "18.20.2"
|
||||
- name: "Install modules"
|
||||
run: npm install
|
||||
run: |
|
||||
npm ci
|
||||
- name: "Run command"
|
||||
run: "npm run lint:${{ matrix.command }}"
|
||||
run: |
|
||||
npm run lint:${{ matrix.command }}
|
||||
unit-tests:
|
||||
name: "Unit tests"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
needs: php-lint
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
|
@ -192,7 +198,7 @@ jobs:
|
|||
composer-dependencies: highest
|
||||
functional-tests:
|
||||
name: "Functional tests"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
needs: php-lint
|
||||
env:
|
||||
DB_DATABASE: typo3
|
||||
|
@ -299,7 +305,7 @@ jobs:
|
|||
composer-dependencies: highest
|
||||
documentation:
|
||||
name: Documentation
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
|
2
.github/workflows/codecoverage.yml
vendored
2
.github/workflows/codecoverage.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
|||
name: "Calculate code coverage"
|
||||
permissions:
|
||||
actions: write
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
DB_DATABASE: typo3
|
||||
DB_USER: root
|
||||
|
|
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
|
@ -10,7 +10,7 @@ jobs:
|
|||
publish:
|
||||
permissions:
|
||||
actions: write
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v4
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,7 +10,6 @@
|
|||
/generate-documentation.sh
|
||||
/nbproject
|
||||
/node_modules/
|
||||
/package-lock.json
|
||||
/var
|
||||
/yarn-error.log
|
||||
/yarn.lock
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.default-frontend:
|
||||
image: node:latest
|
||||
image: node:18
|
||||
needs: [ ]
|
||||
cache:
|
||||
key: "$CI_PROJECT_ID"
|
||||
|
|
2
.npmrc
Normal file
2
.npmrc
Normal file
|
@ -0,0 +1,2 @@
|
|||
lockfile-version=3
|
||||
engine-strict=true
|
1
.nvmrc
Normal file
1
.nvmrc
Normal file
|
@ -0,0 +1 @@
|
|||
v18.19
|
|
@ -1,5 +1,10 @@
|
|||
<?php
|
||||
|
||||
$config = \TYPO3\CodingStandards\CsFixerConfig::create();
|
||||
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
|
||||
use TYPO3\CodingStandards\CsFixerConfig;
|
||||
|
||||
$config = CsFixerConfig::create();
|
||||
// @TODO 4.0 no need to call this manually
|
||||
$config->setParallelConfig(ParallelConfigFactory::detect());
|
||||
$config->getFinder()->in('Classes')->in('Configuration')->in('Tests');
|
||||
return $config;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
|
||||
backupGlobals="true"
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
bootstrap="../.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
|
||||
bootstrap="../../.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
|
||||
cacheResult="false"
|
||||
colors="true"
|
||||
convertDeprecationsToExceptions="true"
|
|
@ -4,7 +4,7 @@
|
|||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
|
||||
backupGlobals="true"
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
bootstrap="../.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php"
|
||||
bootstrap="../../.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php"
|
||||
cacheResult="false"
|
||||
colors="true"
|
||||
convertDeprecationsToExceptions="true"
|
|
@ -9,6 +9,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|||
- Add support for PostgreSQL 16 (#1271)
|
||||
|
||||
### Changed
|
||||
- Move xliff configuration to Build xliff dir (#1356)
|
||||
- Move tests configuration to Build dir (#1352)
|
||||
- Stop storing development tool PHARs in the repository (#1277)
|
||||
- !!! Require a storage PID for the tea list (#1223)
|
||||
- Drop additional namespace segment for the Tea model (#1025)
|
||||
|
|
72
Documentation/Assertions.rst
Normal file
72
Documentation/Assertions.rst
Normal file
|
@ -0,0 +1,72 @@
|
|||
.. include:: /Includes.rst.txt
|
||||
|
||||
.. _assertions-and-type-checks:
|
||||
|
||||
==========================================
|
||||
Our approach to assertions and type checks
|
||||
==========================================
|
||||
|
||||
In general, we use assertions and type checks to catch bad input, to help debug
|
||||
problems, and to help static type analysis tools like PHPStan or Psalm to
|
||||
determine the type and range of a variable where it cannot detect it
|
||||
automatically.
|
||||
|
||||
In production code
|
||||
------------------
|
||||
|
||||
To catch bad input that actually is possible, we throw an exception. This allows
|
||||
developers and users to see what is wrong and to fix it.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
if (!$model instanceof Tea) {
|
||||
throw new \RuntimeException('No model found.', 1687363745);
|
||||
}
|
||||
|
||||
|
||||
To help PHPStan and Psalm with variables where we (as developers) know the type
|
||||
and range for sure, but the tool cannot determine it automatically, we use
|
||||
assertions.
|
||||
|
||||
This makes the type and range obvious both to PHPStan as well as the human
|
||||
reader.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
/**
|
||||
* @return int<0, max>
|
||||
*/
|
||||
private function getUidOfLoggedInUser(): int
|
||||
{
|
||||
$userUid = $this->context->getPropertyFromAspect('frontend.user', 'id');
|
||||
\assert(\is_int($userUid) && $userUid >= 0);
|
||||
|
||||
return $userUid;
|
||||
}
|
||||
|
||||
In tests
|
||||
--------
|
||||
|
||||
In tests, we use PHPUnit's assertions to check the expected outcome of a test,
|
||||
and also to test preconditions.
|
||||
|
||||
This allows us to have test failure messages that help debugging as well as
|
||||
allow PHPStan to determine types.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function findByUidForExistingRecordMapsAllScalarData(): void
|
||||
{
|
||||
$this->importCSVDataSet(__DIR__ . '/Fixtures/TeaWithAllScalarData.csv');
|
||||
|
||||
$model = $this->subject->findByUid(1);
|
||||
self::assertInstanceOf(Tea::class, $model);
|
||||
|
||||
self::assertSame('Earl Grey', $model->getTitle());
|
||||
self::assertSame('Fresh and hot.', $model->getDescription());
|
||||
self::assertSame(2, $model->getOwnerUid());
|
||||
}
|
||||
|
|
@ -51,6 +51,7 @@ continuous integration.
|
|||
ContinuousIntegration
|
||||
Documentation
|
||||
Security
|
||||
Assertions
|
||||
DivergencesToTypo3Core
|
||||
|
||||
.. Meta Menu
|
||||
|
|
|
@ -47,29 +47,29 @@
|
|||
"typo3/cms-frontend": "^11.5.4 || ^12.4.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"ergebnis/composer-normalize": "^2.42.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.56.0",
|
||||
"ergebnis/composer-normalize": "^2.43.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.60.0",
|
||||
"helmich/typo3-typoscript-lint": "^3.1.1",
|
||||
"php-coveralls/php-coveralls": "^2.7.0",
|
||||
"phpstan/extension-installer": "^1.3.1",
|
||||
"phpstan/phpstan": "^1.10.67",
|
||||
"phpstan/phpstan-phpunit": "^1.3.16",
|
||||
"phpstan/phpstan-strict-rules": "^1.5.5",
|
||||
"phpunit/phpunit": "^9.6.19",
|
||||
"saschaegerer/phpstan-typo3": "^1.10.0",
|
||||
"seld/jsonlint": "^1.10.2",
|
||||
"spaze/phpstan-disallowed-calls": "^3.3",
|
||||
"squizlabs/php_codesniffer": "^3.9.2",
|
||||
"ssch/typo3-rector": "^2.5.0",
|
||||
"phpstan/extension-installer": "^1.4.1",
|
||||
"phpstan/phpstan": "^1.11.8",
|
||||
"phpstan/phpstan-phpunit": "^1.4.0",
|
||||
"phpstan/phpstan-strict-rules": "^1.6.0",
|
||||
"phpunit/phpunit": "^9.6.20",
|
||||
"saschaegerer/phpstan-typo3": "^1.10.1",
|
||||
"seld/jsonlint": "^1.11.0",
|
||||
"spaze/phpstan-disallowed-calls": "^3.4",
|
||||
"squizlabs/php_codesniffer": "^3.10.2",
|
||||
"ssch/typo3-rector": "^2.6.4",
|
||||
"ssch/typo3-rector-testing-framework": "^2.0.1",
|
||||
"symfony/console": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/translation": "^5.4 || ^6.4 || ^7.0",
|
||||
"symfony/yaml": "^5.4 || ^6.4 || ^7.0",
|
||||
"tomasvotruba/cognitive-complexity": "^0.2.3",
|
||||
"tomasvotruba/type-coverage": "^0.2.8",
|
||||
"tomasvotruba/type-coverage": "^0.3.1",
|
||||
"typo3/cms-fluid-styled-content": "^11.5.4 || ^12.4.2",
|
||||
"typo3/coding-standards": "^0.6.1",
|
||||
"typo3/testing-framework": "^7.0.4",
|
||||
"typo3/testing-framework": "^7.0.5",
|
||||
"webmozart/assert": "^1.11.0"
|
||||
},
|
||||
"replace": {
|
||||
|
@ -124,7 +124,7 @@
|
|||
"ci:coverage:functional": [
|
||||
"@ci:tests:create-directories",
|
||||
"@coverage:create-directories",
|
||||
".Build/bin/phpunit -c ./Configuration/FunctionalTests.xml --whitelist Classes --coverage-php=.Build/coverage/functional.cov Tests/Functional"
|
||||
".Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --whitelist Classes --coverage-php=.Build/coverage/functional.cov Tests/Functional"
|
||||
],
|
||||
"ci:coverage:merge": [
|
||||
"@coverage:create-directories",
|
||||
|
@ -132,7 +132,7 @@
|
|||
],
|
||||
"ci:coverage:unit": [
|
||||
"@coverage:create-directories",
|
||||
".Build/bin/phpunit -c ./Configuration/UnitTests.xml --whitelist Classes --coverage-php=.Build/coverage/unit.cov Tests/Unit"
|
||||
".Build/bin/phpunit -c Build/phpunit/UnitTests.xml --whitelist Classes --coverage-php=.Build/coverage/unit.cov Tests/Unit"
|
||||
],
|
||||
"ci:json:lint": "find . ! -path '*/.cache/*' ! -path '*/.Build/*' ! -path '*/node_modules/*' -name '*.json' | xargs -r php .Build/bin/jsonlint -q",
|
||||
"ci:php": [
|
||||
|
@ -159,11 +159,11 @@
|
|||
"ci:tests:create-directories": "mkdir -p .Build/public/typo3temp/var/tests",
|
||||
"ci:tests:functional": [
|
||||
"@ci:tests:create-directories",
|
||||
"find 'Tests/Functional' -wholename '*Test.php' | parallel --gnu 'echo; echo \"Running functional test suite {}\"; .Build/bin/phpunit -c ./Configuration/FunctionalTests.xml {}';"
|
||||
"find 'Tests/Functional' -wholename '*Test.php' | parallel --gnu 'echo; echo \\\"Running functional test suite {}\\\"; .Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml {}';"
|
||||
],
|
||||
"ci:tests:unit": ".Build/bin/phpunit -c ./Configuration/UnitTests.xml Tests/Unit",
|
||||
"ci:tests:unit": ".Build/bin/phpunit -c Build/phpunit/UnitTests.xml Tests/Unit",
|
||||
"ci:ts:lint": "typoscript-lint -c Configuration/TsLint.yml --ansi -n --fail-on-warnings -vvv Configuration/TypoScript",
|
||||
"ci:xliff:lint": "php Build/bin/xliff-lint lint:xliff Resources/Private/Language",
|
||||
"ci:xliff:lint": "php Build/xliff/xliff-lint lint:xliff Resources/Private/Language",
|
||||
"ci:yaml:lint": "find . ! -path '*.Build/*' ! -path '*node_modules/*' \\( -name '*.yaml' -o -name '*.yml' \\) | xargs -r php ./.Build/bin/yaml-lint",
|
||||
"coverage:create-directories": "mkdir -p .Build/logs .Build/coverage",
|
||||
"docs:generate": "docker run --rm --pull always -v $(pwd):/project -it ghcr.io/typo3-documentation/render-guides:latest --config=Documentation",
|
||||
|
@ -188,10 +188,13 @@
|
|||
"rm .eslintrc.json",
|
||||
"rm .gitattributes",
|
||||
"rm .gitignore",
|
||||
"rm .npmrc",
|
||||
"rm .nvmrc",
|
||||
"rm .php-cs-fixer.php",
|
||||
"rm .prettierrc.js",
|
||||
"rm Configuration/FunctionalTests.xml",
|
||||
"rm Configuration/UnitTests.xml",
|
||||
"rm Build/phpunit/FunctionalTests.xml",
|
||||
"rm Build/phpunit/UnitTests.xml",
|
||||
"rm package-lock.json",
|
||||
"rm package.json",
|
||||
"rm phive.xml",
|
||||
"rm phpcs.xml",
|
||||
|
|
5038
package-lock.json
generated
Normal file
5038
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,11 @@
|
|||
"type": "module",
|
||||
"author": "",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"engines": {
|
||||
"node": "^18.20.0",
|
||||
"npm": "^10.5.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint:js": "eslint 'Resources/Public/**/*.js'",
|
||||
"lint:js:fix": "eslint 'Resources/Public/**/*.js' --quiet --fix",
|
||||
|
|
Loading…
Reference in a new issue