Skip to content

[TASK] Add basic unit and functional tests#2107

Open
sbuerk wants to merge 1 commit into
TYPO3BestPractices:mainfrom
sbuerk:version-tests
Open

[TASK] Add basic unit and functional tests#2107
sbuerk wants to merge 1 commit into
TYPO3BestPractices:mainfrom
sbuerk:version-tests

Conversation

@sbuerk
Copy link
Copy Markdown
Contributor

@sbuerk sbuerk commented May 1, 2026

This change adds following tests:

  • Tests/Functional/ExtensionLoadedTest.php to verify that
    extension is detected as loaded with expected extension
    key and composer package name. On top it tests against
    expected TYPO3 core versions using group excludes, which
    helps to simpler detect if tests for one core version
    are executed with the other version installed.

  • Tests/Unit/VersionCompatTest.php tests against expected
    TYPO3 core versions using group excludes, which helps to
    simpler detect if tests for one core version are executed
    with the other version installed.

In general these two tests can act as first tests for any
extension to have unit and functional test infrastructure
added. Having at least the functional tests helps detecting
DI container compile issues or automatic TCA migrations and
related deprecations early - even if no other thats are added.

For example, if 12.4 has been used to install the dependencies
and the unit/functional tests are executed giving the -t 13.4
option these tests will fail and indicates this - other failures
can than be early ruled out and avoids wasting debug time

ci.yaml is modified to call unit and functional test with the
same TYPO3 version used to setup the system.

Note

Existing similar tests are removed in favour of the new ones,
and having them on the lowest level makes them easy findable.

@oliverklee oliverklee added the enhancement New feature or request label May 1, 2026
@oliverklee oliverklee added this to the 4.1.0 milestone May 1, 2026
oliverklee

This comment was marked as outdated.

@sbuerk sbuerk force-pushed the version-tests branch 4 times, most recently from 470c226 to 1717380 Compare May 1, 2026 12:58
@sbuerk sbuerk requested a review from oliverklee May 1, 2026 12:58
This change adds following tests:

* `Tests/Functional/ExtensionLoadedTest.php` to verify that
   extension is detected as loaded with expected extension
   key and composer package name. On top it tests against
   expected TYPO3 core versions using group excludes, which
   helps to simpler detect if tests for one core version
   are executed with the other version installed.

*  `Tests/Unit/VersionCompatTest.php`  tests against expected
   TYPO3 core versions using group excludes, which  helps to
   simpler detect if tests for one core version are executed
   with the other version installed.

In general these two tests can act as first tests for any
extension to have unit and functional test infrastructure
added. Having at least the functional tests helps detecting
DI container compile issues or automatic TCA migrations and
related deprecations early - even if no other thats are added.

For example, if `12.4` has been used to install the dependencies
and the unit/functional tests are executed giving the `-t 13.4`
option these tests will fail and indicates this - other failures
can than be early ruled out and avoids wasting debug time

`ci.yaml` is modified to call unit and functional test with the
same TYPO3 version used to setup the system.

> [!NOTE]
> Existing similar tests are removed in favour of the new ones,
> and having them on the lowest level makes them easy findable.
@oliverklee
Copy link
Copy Markdown
Contributor

I've created a pre-PR for moving and renaming the testcases: #2108

Copy link
Copy Markdown
Contributor

@oliverklee oliverklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not a full review yet, and would like the pre-PR to get merged first)

* This can and should be used in every extension instead of dummy assertTrue(true) filler.
*/
#[CoversNothing]
final class VersionCompatTest extends UnitTestCase
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid the abbreviation:

Suggested change
final class VersionCompatTest extends UnitTestCase
final class VersionCompatibiltyTest extends UnitTestCase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants