Skip to content

Commit

Permalink
fix cache tests test: Update test launch script and PHP attribute in …
Browse files Browse the repository at this point in the history
…cache tests
  • Loading branch information
SebSept authored Jan 14, 2025
1 parent 78d50b2 commit 4b9fbae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
24 changes: 11 additions & 13 deletions .github/actions/test_tests-cache.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions phpunit/functional/Calendar_HolidayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use Calendar;
use DbTestCase;
use Holiday;
use PHPUnit\Framework\Attributes\Group;

/* Test for inc/calendar_holiday.class.php */

Expand Down Expand Up @@ -77,9 +78,8 @@ public function testGetHolidaysForCalendar()
$this->assertEquals([], $holidays);
}

/**
* @tags cache
*/

#[Group('cache')]
public function testHolidaysCache()
{
global $GLPI_CACHE;
Expand Down
9 changes: 3 additions & 6 deletions phpunit/functional/DbUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -937,9 +938,7 @@ public function testGetAncestorsOf()
$this->runGetAncestorsOf();
}

/**
* @tags cache
*/
#[Group('cache')]
public function testGetAncestorsOfCached()
{
$this->login();
Expand Down Expand Up @@ -1129,9 +1128,7 @@ public function testGetSonsOf()
$this->runGetSonsOf();
}

/**
* @tags cache
*/
#[Group('cache')]
public function testGetSonsOfCached()
{
$this->login();
Expand Down
9 changes: 3 additions & 6 deletions phpunit/functional/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -283,9 +284,7 @@ public function testChangeEntityParent()
$this->runChangeEntityParent();
}

/**
* @tags cache
*/
#[Group('cache')]
public function testChangeEntityParentCached()
{
//run with cache
Expand All @@ -302,9 +301,7 @@ public function testMoveParentEntity(): void
$this->doTestMoveParentEntity(false);
}

/**
* @tags cache
*/
#[Group('cache')]
public function testMoveParentEntityCached(): void
{
$this->doTestMoveParentEntity(true);
Expand Down

0 comments on commit 4b9fbae

Please sign in to comment.