diff --git a/.github/actions/test_tests-cache.sh b/.github/actions/test_tests-cache.sh index 61927ba6ed5..79980e713b3 100755 --- a/.github/actions/test_tests-cache.sh +++ b/.github/actions/test_tests-cache.sh @@ -1,22 +1,20 @@ #!/bin/bash set -e -u -x -o pipefail -TMP_CACHE_DIR=$(mktemp -d -t glpi-cache-test-XXXXXXXXXX) +PHPUNIT_ADDITIONNAL_OPTIONS="" +if [[ "${CODE_COVERAGE:-}" = true ]]; then + export COVERAGE_DIR="coverage-functional" + PHPUNIT_ADDITIONNAL_OPTIONS="--coverage-filter src --coverage-clover phpunit/$COVERAGE_DIR/clover.xml" + +else + PHPUNIT_ADDITIONNAL_OPTIONS="--no-coverage"; +fi for CONFIG in {"--use-default","--dsn=memcached://memcached","--dsn=redis://redis"}; do php bin/console cache:configure \ --ansi --no-interaction \ $CONFIG - vendor/bin/atoum \ - -p 'php -d memory_limit=512M' \ - --debug \ - --force-terminal \ - --use-dot-report \ - --bootstrap-file tests/bootstrap.php \ - --fail-if-void-methods \ - --fail-if-skipped-methods \ - --no-code-coverage \ - --max-children-number 1 \ - -d tests/functional \ - -t cache + vendor/bin/phpunit --group cache $PHPUNIT_ADDITIONNAL_OPTIONS $@ done + +unset COVERAGE_DIR diff --git a/phpunit/functional/Calendar_HolidayTest.php b/phpunit/functional/Calendar_HolidayTest.php index 390c53b93fc..2fe27bccc8f 100644 --- a/phpunit/functional/Calendar_HolidayTest.php +++ b/phpunit/functional/Calendar_HolidayTest.php @@ -38,6 +38,7 @@ use Calendar; use DbTestCase; use Holiday; +use PHPUnit\Framework\Attributes\Group; /* Test for inc/calendar_holiday.class.php */ @@ -77,9 +78,8 @@ public function testGetHolidaysForCalendar() $this->assertEquals([], $holidays); } - /** - * @tags cache - */ + + #[Group('cache')] public function testHolidaysCache() { global $GLPI_CACHE; diff --git a/phpunit/functional/DbUtilsTest.php b/phpunit/functional/DbUtilsTest.php index 70b9d85b686..1318e2e6c81 100644 --- a/phpunit/functional/DbUtilsTest.php +++ b/phpunit/functional/DbUtilsTest.php @@ -38,6 +38,7 @@ use DbTestCase; use org\bovigo\vfs\vfsStream; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Psr\Log\LogLevel; /* Test for inc/dbutils.class.php */ @@ -937,9 +938,7 @@ public function testGetAncestorsOf() $this->runGetAncestorsOf(); } - /** - * @tags cache - */ + #[Group('cache')] public function testGetAncestorsOfCached() { $this->login(); @@ -1129,9 +1128,7 @@ public function testGetSonsOf() $this->runGetSonsOf(); } - /** - * @tags cache - */ + #[Group('cache')] public function testGetSonsOfCached() { $this->login(); diff --git a/phpunit/functional/EntityTest.php b/phpunit/functional/EntityTest.php index 9b188edfe54..11502e3c5ce 100644 --- a/phpunit/functional/EntityTest.php +++ b/phpunit/functional/EntityTest.php @@ -43,6 +43,7 @@ use NotificationTarget; use NotificationTargetTicket; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use Profile_User; use Ticket; use Ticket_Contract; @@ -283,9 +284,7 @@ public function testChangeEntityParent() $this->runChangeEntityParent(); } - /** - * @tags cache - */ + #[Group('cache')] public function testChangeEntityParentCached() { //run with cache @@ -302,9 +301,7 @@ public function testMoveParentEntity(): void $this->doTestMoveParentEntity(false); } - /** - * @tags cache - */ + #[Group('cache')] public function testMoveParentEntityCached(): void { $this->doTestMoveParentEntity(true);