Skip to content

Commit

Permalink
Skip Session Manager tests on PHP 8.1 as old version of PHPUnit (#38133)
Browse files Browse the repository at this point in the history
* Skip Session Manager tests on PHP 8.1 as old version of PHPUnit

* Ensure various tests are no longer allowed to fail

* Update signature

* Update tests/Unit/Libraries/Cms/Session/SessionManagerTest.php

Co-authored-by: Harald Leithner <leithner@itronic.at>
  • Loading branch information
wilsonge and HLeithner authored Jun 24, 2022
1 parent dbb77cd commit 54ed990
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ steps:
- name: php81-unit
depends_on: [ phpcs ]
image: joomlaprojects/docker-images:php8.1
failure: ignore
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Unit
Expand Down Expand Up @@ -88,7 +87,6 @@ steps:
- name: php80-integration
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.0
failure: ignore
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration
Expand Down Expand Up @@ -131,7 +129,6 @@ steps:
- name: php80-integration-pgsql
depends_on: [ npm ]
image: joomlaprojects/docker-images:php8.0
failure: ignore
commands:
- php -v
- ./libraries/vendor/bin/phpunit --testsuite Integration --configuration phpunit-pgsql.xml.dist
Expand Down Expand Up @@ -478,6 +475,6 @@ trigger:

---
kind: signature
hmac: 234ae9e7e2fbfa114ba754c68056dec518c76a93de2f5b098f569e355b50cc1b
hmac: d5db8148323f0205a8c0cd165da3934f5a77b25f73862d09ead95d3c42f1df01

...
10 changes: 10 additions & 0 deletions tests/Unit/Libraries/Cms/Session/SessionManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ class SessionManagerTest extends UnitTestCase
*/
protected function setUp(): void
{
// @todo remove this after upgrading phpunit to 9+ see https://github.com/sebastianbergmann/phpunit/issues/4879
if (version_compare(phpversion(), '8.1.0', '>='))
{
/**
* See https://github.com/sebastianbergmann/phpunit/issues/4879 - we'll need a higher phpunit version for 8.1 and
* higher for this to work
*/
$this->markTestSkipped('PHPUnit 8 cannot mock SessionHandlerInterface in PHP 8.1 and higher');
}

$this->sessionHandler = $this->createMock(\SessionHandlerInterface::class);

$this->manager = new SessionManager($this->sessionHandler);
Expand Down

0 comments on commit 54ed990

Please sign in to comment.