Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -t ${{matrix.typo3-version}} -s composerUpdate${{matrix.composer-dependencies}}
- name: Run unit tests
run: |
./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -s unit
./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -t ${{matrix.typo3-version}} -s unit
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -t ${{matrix.typo3-version}} -s composerUpdate${{matrix.composer-dependencies}}
- name: Run functional tests
run: |
./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -d ${{ matrix.dbms }} -s functional
./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -t ${{matrix.typo3-version}} -d ${{ matrix.dbms }} -s functional
strategy:
fail-fast: false
matrix:
Expand Down
8 changes: 4 additions & 4 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# shellcheck disable=SC2086,SC2046,SC2128,SC2178,SC2206
# shellcheck disable=SC2086,SC2046,SC2128,SC2178,SC2206,SC2054

# Uncomment for debugging
# set -x
Expand Down Expand Up @@ -599,7 +599,7 @@ case ${TEST_SUITE} in
SUITE_EXIT_CODE=$?
;;
functional)
COMMAND=(.Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group not-${DBMS} "$@")
COMMAND=(.Build/bin/phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group not-${DBMS},not-core-${CORE_VERSION} "$@")
case ${DBMS} in
mariadb)
echo "Using driver: ${DATABASE_DRIVER}"
Expand Down Expand Up @@ -712,11 +712,11 @@ case ${TEST_SUITE} in
SUITE_EXIT_CODE=$?
;;
unit)
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name unit-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_PHP} .Build/bin/phpunit -c Build/phpunit/UnitTests.xml "$@"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name unit-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_PHP} .Build/bin/phpunit -c Build/phpunit/UnitTests.xml --exclude-group not-core-${CORE_VERSION} "$@"
SUITE_EXIT_CODE=$?
;;
unitRandom)
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name unit-random-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_PHP} .Build/bin/phpunit -c Build/phpunit/UnitTests.xml --order-by=random ${PHPUNIT_RANDOM} "$@"
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name unit-random-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${IMAGE_PHP} .Build/bin/phpunit -c Build/phpunit/UnitTests.xml --exclude-group not-core-${CORE_VERSION} --order-by=random ${PHPUNIT_RANDOM} "$@"
SUITE_EXIT_CODE=$?
;;
update)
Expand Down
25 changes: 0 additions & 25 deletions Tests/Functional/Environment/ExtensionTest.php

This file was deleted.

62 changes: 62 additions & 0 deletions Tests/Functional/ExtensionLoadedTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

namespace TTN\Tea\Tests\Functional;

use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* Basic unit tests.
*
* This can and should be used in every extension instead of dummy assertTrue(true) filler.
* This checks against supported version and additional ensures that the test execution is
* using the same core version installed, which can help to rule out other test failures
* early due to wrong TYPO3 version usage.
*/
#[CoversNothing]
final class ExtensionLoadedTest extends FunctionalTestCase
{
private const ALLOWED_MAJOR_VERSIONS = [12, 13];

protected array $testExtensionsToLoad = [
'ttn/tea',
];

#[Test]
public function isLoadedExtensionKey(): void
{
self::assertTrue(ExtensionManagementUtility::isLoaded('tea'));
}

#[Test]
public function isLoadedComposerPackageName(): void
{
self::assertTrue(ExtensionManagementUtility::isLoaded('ttn/tea'));
}

#[Test]
public function allowedMajorTypo3Version(): void
{
self::assertContains((new Typo3Version())->getMajorVersion(), self::ALLOWED_MAJOR_VERSIONS);
}

#[Group('not-core-13.4')]
#[Test]
public function verifyCore12(): void
{
self::assertSame(12, (new Typo3Version())->getMajorVersion());
}

#[Group('not-core-12.4')]
#[Test]
public function verifyCore13(): void
{
self::assertSame(13, (new Typo3Version())->getMajorVersion());
}
}
25 changes: 0 additions & 25 deletions Tests/Unit/Environment/ExtensionTest.php

This file was deleted.

42 changes: 42 additions & 0 deletions Tests/Unit/VersionCompatTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace TTN\Tea\Tests\Unit;

use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

/**
* Basic unit tests.
*
* 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

{
private const ALLOWED_MAJOR_VERSIONS = [12, 13];

#[Test]
public function allowedMajorTypo3Version(): void
{
self::assertContains((new Typo3Version())->getMajorVersion(), self::ALLOWED_MAJOR_VERSIONS);
}

#[Group('not-core-13.4')]
#[Test]
public function verifyCore12(): void
{
self::assertSame(12, (new Typo3Version())->getMajorVersion());
}

#[Group('not-core-12.4')]
#[Test]
public function verifyCore13(): void
{
self::assertSame(13, (new Typo3Version())->getMajorVersion());
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@
"check:coverage:functional": [
"@check:tests:create-directories",
"@coverage:create-directories",
"phpunit -c Build/phpunit/FunctionalTests.xml --coverage-php=build/coverage/functional.cov"
"phpunit -c Build/phpunit/FunctionalTests.xml --exclude-group not-core-13.4 --coverage-php=build/coverage/functional.cov"
],
"check:coverage:merge": [
"@coverage:create-directories",
"@php tools/phpcov merge --clover=build/logs/clover.xml build/coverage/"
],
"check:coverage:unit": [
"@coverage:create-directories",
"phpunit -c Build/phpunit/UnitTests.xml --coverage-php=build/coverage/unit.cov"
"phpunit -c Build/phpunit/UnitTests.xml --exclude-group not-core-13.4 --coverage-php=build/coverage/unit.cov"
],
"check:json:lint": "find . ! -path '*/.cache/*' ! -path '*/.Build/*' ! -path '*/node_modules/*' -name '*.json' | xargs -r php .Build/bin/jsonlint -q",
"check:php": [
Expand Down