From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Fri, 26 Sep 2025 07:56:04 +0200
Subject: Compatibility with recent PHPUnit (12)

---
 libs/jsonrpc/tests/ClientTest.php                  |  12 +-
 libs/jsonrpc/tests/HttpClientTest.php              |  12 +-
 tests/units/Auth/ReverseProxyAuthTest.php          |  12 +-
 tests/units/Core/Cache/MemoryCacheTest.php         |   3 +-
 .../Core/ExternalTask/ExternalTaskManagerTest.php  |   6 +-
 tests/units/Core/Http/OAuth2Test.php               |   2 +-
 tests/units/Core/Http/RememberMeCookieTest.php     |   5 +-
 tests/units/Core/Ldap/ClientTest.php               |  25 ++--
 tests/units/Core/Ldap/LdapGroupTest.php            |  18 +--
 tests/units/Core/Ldap/LdapUserTest.php             | 160 ++++++++++-----------
 tests/units/Core/Ldap/QueryTest.php                |  17 +--
 tests/units/Core/Plugin/DirectoryTest.php          |   2 +-
 .../units/Decorator/MetadataCacheDecoratorTest.php |  12 +-
 tests/units/ExternalLink/WebLinkTest.php           |   4 +-
 tests/units/Helper/HookHelperTest.php              |  10 +-
 tests/units/Job/CommentEventJobTest.php            |   2 +-
 tests/units/Job/TaskEventJobTest.php               |   2 +-
 .../ApplicationAuthorizationMiddlewareTest.php     |   4 +-
 .../Middleware/AuthenticationMiddlewareTest.php    |  19 +--
 .../ProjectAuthorizationMiddlewareTest.php         |   8 +-
 tests/units/Model/UserNotificationTest.php         |   3 +-
 21 files changed, 172 insertions(+), 166 deletions(-)

diff --git a/libs/jsonrpc/tests/ClientTest.php b/libs/jsonrpc/tests/ClientTest.php
index cec9ad3..4a61b73 100644
--- a/libs/jsonrpc/tests/ClientTest.php
+++ b/libs/jsonrpc/tests/ClientTest.php
@@ -36,7 +36,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('execute')
             ->with($this->stringContains('[{"jsonrpc":"2.0","method":"methodA","id":'))
-            ->will($this->returnValue($response));
+            ->willReturn($response);
 
 
         $result = $client->batch()
@@ -55,7 +55,7 @@ class ClientTest extends PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('execute')
             ->with($this->stringContains('{"jsonrpc":"2.0","method":"methodA","id":'))
-            ->will($this->returnValue(array('jsonrpc' => '2.0', 'result' => 'foobar', 'id' => 1)));
+            ->willReturn(array('jsonrpc' => '2.0', 'result' => 'foobar', 'id' => 1));
 
         $result = $client->execute('methodA', array('a' => 'b'));
         $this->assertEquals($result, 'foobar');
@@ -69,13 +69,13 @@ class ClientTest extends PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('execute')
             ->with($this->stringContains('{"jsonrpc":"2.0","method":"methodA","id":'))
-            ->will($this->returnValue(array(
+            ->willReturn(array(
                 'jsonrpc' => '2.0',
                 'error' => array(
                     'code' => -32601,
                     'message' => 'Method not found',
                 ),
-            )));
+            ));
 
         $this->expectException('BadFunctionCallException');
         $client->execute('methodA', array('a' => 'b'));
@@ -89,13 +89,13 @@ class ClientTest extends PHPUnit_Framework_TestCase
             ->expects($this->once())
             ->method('execute')
             ->with($this->stringContains('{"jsonrpc":"2.0","method":"methodA","id":'))
-            ->will($this->returnValue(array(
+            ->willReturn(array(
                 'jsonrpc' => '2.0',
                 'error' => array(
                     'code' => -32601,
                     'message' => 'Method not found',
                 ),
-            )));
+            ));
 
         $result = $client->execute('methodA', array('a' => 'b'));
         $this->assertInstanceOf('BadFunctionCallException', $result);
diff --git a/libs/jsonrpc/tests/HttpClientTest.php b/libs/jsonrpc/tests/HttpClientTest.php
index d4e3734..9735568 100644
--- a/libs/jsonrpc/tests/HttpClientTest.php
+++ b/libs/jsonrpc/tests/HttpClientTest.php
@@ -110,7 +110,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
             ->expects($this->at(0))
             ->method('extension_loaded')
             ->with('curl')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         self::$functions
             ->expects($this->at(1))
@@ -136,13 +136,13 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
                     'verify_peer_name' => true,
                 )
             ))
-            ->will($this->returnValue('context'));
+            ->willReturn('context');
 
         self::$functions
             ->expects($this->at(2))
             ->method('fopen')
             ->with('url', 'r', false, 'context')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $httpClient = new HttpClient('url');
         $httpClient->withBeforeRequestCallback(function(HttpClient $client, $payload) {
@@ -159,12 +159,12 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
             ->expects($this->at(0))
             ->method('extension_loaded')
             ->with('curl')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         self::$functions
             ->expects($this->at(1))
             ->method('curl_init')
-            ->will($this->returnValue('curl'));
+            ->willReturn('curl');
 
         self::$functions
             ->expects($this->at(2))
@@ -199,7 +199,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase
             ->expects($this->at(4))
             ->method('curl_exec')
             ->with('curl')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         self::$functions
             ->expects($this->at(5))
diff --git a/tests/units/Auth/ReverseProxyAuthTest.php b/tests/units/Auth/ReverseProxyAuthTest.php
index 0ddce1e..3fa6556 100644
--- a/tests/units/Auth/ReverseProxyAuthTest.php
+++ b/tests/units/Auth/ReverseProxyAuthTest.php
@@ -31,7 +31,7 @@ class ReverseProxyAuthTest extends Base
         $this->container['request']
             ->expects($this->once())
             ->method('getRemoteUser')
-            ->will($this->returnValue('admin'));
+            ->willReturn('admin');
 
         $provider = new ReverseProxyAuth($this->container);
         $this->assertTrue($provider->authenticate());
@@ -42,7 +42,7 @@ class ReverseProxyAuthTest extends Base
         $this->container['request']
             ->expects($this->once())
             ->method('getRemoteUser')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $provider = new ReverseProxyAuth($this->container);
         $this->assertFalse($provider->authenticate());
@@ -53,7 +53,7 @@ class ReverseProxyAuthTest extends Base
         $this->container['request']
             ->expects($this->once())
             ->method('getRemoteUser')
-            ->will($this->returnValue('admin'));
+            ->willReturn('admin');
 
         $_SESSION['user'] = array(
             'username' => 'admin'
@@ -68,7 +68,7 @@ class ReverseProxyAuthTest extends Base
         $this->container['request']
             ->expects($this->once())
             ->method('getRemoteUser')
-            ->will($this->returnValue('foobar'));
+            ->willReturn('foobar');
 
         $_SESSION['user'] = array(
             'username' => 'admin'
@@ -83,7 +83,7 @@ class ReverseProxyAuthTest extends Base
         $this->container['request']
             ->expects($this->once())
             ->method('getRemoteUser')
-            ->will($this->returnValue('someone'));
+            ->willReturn('someone');
 
         $provider = new ReverseProxyAuth($this->container);
         $this->assertTrue($provider->authenticate());
@@ -97,7 +97,7 @@ class ReverseProxyAuthTest extends Base
         $this->container['request']
             ->expects($this->once())
             ->method('getRemoteUser')
-            ->will($this->returnValue('someone'));
+            ->willReturn('someone');
 
         $provider = new ReverseProxyAuth($this->container);
         $userModel = new UserModel($this->container);
diff --git a/tests/units/Core/Cache/MemoryCacheTest.php b/tests/units/Core/Cache/MemoryCacheTest.php
index bc7c0bc..4ab0b46 100644
--- a/tests/units/Core/Cache/MemoryCacheTest.php
+++ b/tests/units/Core/Cache/MemoryCacheTest.php
@@ -36,6 +36,7 @@ class MemoryCacheTest extends Base
         $this->assertEquals(null, $c->get('mykey'));
     }
 
+    #[\PHPUnit\Framework\Attributes\RequiresPhpunit('< 12')]
     public function testProxy()
     {
         $c = new MemoryCache;
@@ -52,7 +53,7 @@ class MemoryCacheTest extends Base
                 $this->equalTo(1),
                 $this->equalTo(2)
             )
-            ->will($this->returnValue(3));
+            ->willReturn(3);
 
         // First call will store the computed value
         $this->assertEquals(3, $c->proxy($class, 'doSomething', 1, 2));
diff --git a/tests/units/Core/ExternalTask/ExternalTaskManagerTest.php b/tests/units/Core/ExternalTask/ExternalTaskManagerTest.php
index 84c8b8f..4abf59a 100644
--- a/tests/units/Core/ExternalTask/ExternalTaskManagerTest.php
+++ b/tests/units/Core/ExternalTask/ExternalTaskManagerTest.php
@@ -17,7 +17,7 @@ class ExternalTaskManagerTest extends Base
 
     public function testRegister()
     {
-        $provider = $this->getMockBuilder('Kanboard\Core\ExternalTask\ExternalTaskProviderInterface')->getMock();
+        $provider = $this->createMock('Kanboard\Core\ExternalTask\ExternalTaskProviderInterface');
         $provider->expects($this->any())->method('getName')->willReturn('MyProvider');
 
         $manager = new ExternalTaskManager();
@@ -28,10 +28,10 @@ class ExternalTaskManagerTest extends Base
 
     public function testGetList()
     {
-        $provider1 = $this->getMockBuilder('Kanboard\Core\ExternalTask\ExternalTaskProviderInterface')->getMock();
+        $provider1 = $this->createMock('Kanboard\Core\ExternalTask\ExternalTaskProviderInterface');
         $provider1->expects($this->any())->method('getName')->willReturn('MyProvider1');
 
-        $provider2 = $this->getMockBuilder('Kanboard\Core\ExternalTask\ExternalTaskProviderInterface')->getMock();
+        $provider2 = $this->createMock('Kanboard\Core\ExternalTask\ExternalTaskProviderInterface');
         $provider2->expects($this->any())->method('getName')->willReturn('MyProvider2');
 
         $manager = new ExternalTaskManager();
diff --git a/tests/units/Core/Http/OAuth2Test.php b/tests/units/Core/Http/OAuth2Test.php
index 33dbc42..96174bc 100644
--- a/tests/units/Core/Http/OAuth2Test.php
+++ b/tests/units/Core/Http/OAuth2Test.php
@@ -49,7 +49,7 @@ class OAuth2Test extends Base
             ->expects($this->once())
             ->method('postForm')
             ->with('E', $params, array('Accept: application/json'))
-            ->will($this->returnValue($response));
+            ->willReturn($response);
 
         $oauth->createService('A', 'B', 'C', 'D', 'E', array('f', 'g'));
         $oauth->getAccessToken('something');
diff --git a/tests/units/Core/Http/RememberMeCookieTest.php b/tests/units/Core/Http/RememberMeCookieTest.php
index a0e8cfb..255ef9d 100644
--- a/tests/units/Core/Http/RememberMeCookieTest.php
+++ b/tests/units/Core/Http/RememberMeCookieTest.php
@@ -15,6 +15,7 @@ use Kanboard\Core\Http\RememberMeCookie;
 use Kanboard\Core\Http\Request;
 use KanboardTests\units\Base;
 
+#[\PHPUnit\Framework\Attributes\RequiresPhpunit('< 12')]
 class RememberMeCookieTest extends Base
 {
     public static $functions;
@@ -74,7 +75,7 @@ class RememberMeCookieTest extends Base
                 false,
                 true
             )
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $cookie = new RememberMeCookie($this->container);
         $this->assertTrue($cookie->write('myToken', 'mySequence', 1234));
@@ -106,7 +107,7 @@ class RememberMeCookieTest extends Base
                 false,
                 true
             )
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $cookie = new RememberMeCookie($this->container);
         $this->assertTrue($cookie->remove());
diff --git a/tests/units/Core/Ldap/ClientTest.php b/tests/units/Core/Ldap/ClientTest.php
index 9f453db..84c3fa3 100644
--- a/tests/units/Core/Ldap/ClientTest.php
+++ b/tests/units/Core/Ldap/ClientTest.php
@@ -43,6 +43,7 @@ namespace KanboardTests\units\Core\Ldap;
 use Kanboard\Core\Ldap\Client;
 use KanboardTests\units\Base;
 
+#[\PHPUnit\Framework\Attributes\RequiresPhpunit('< 12')]
 class ClientTest extends Base
 {
     public static $functions;
@@ -87,7 +88,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_server'),
                 $this->equalTo(389)
             )
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $ldap = new Client;
         $ldap->open('my_ldap_server');
@@ -103,7 +104,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_server'),
                 $this->equalTo(389)
             )
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->expectException('\Kanboard\Core\Ldap\ConnectionException');
 
@@ -121,7 +122,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_server'),
                 $this->equalTo(389)
             )
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         self::$functions
             ->expects($this->once())
@@ -129,7 +130,7 @@ class ClientTest extends Base
             ->with(
                 $this->equalTo('my_ldap_resource')
             )
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $ldap = new Client;
         $ldap->open('my_ldap_server', 389, true);
@@ -145,7 +146,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_server'),
                 $this->equalTo(389)
             )
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         self::$functions
             ->expects($this->once())
@@ -153,7 +154,7 @@ class ClientTest extends Base
             ->with(
                 $this->equalTo('my_ldap_resource')
             )
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->expectException('\Kanboard\Core\Ldap\ConnectionException');
 
@@ -167,7 +168,7 @@ class ClientTest extends Base
         self::$functions
             ->expects($this->once())
             ->method('ldap_bind')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $ldap = new Client;
         $this->assertTrue($ldap->useAnonymousAuthentication());
@@ -178,7 +179,7 @@ class ClientTest extends Base
         self::$functions
             ->expects($this->once())
             ->method('ldap_bind')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->expectException('\Kanboard\Core\Ldap\ClientException');
 
@@ -195,7 +196,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_server'),
                 $this->equalTo(389)
             )
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         self::$functions
             ->expects($this->once())
@@ -205,7 +206,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_user'),
                 $this->equalTo('my_ldap_password')
             )
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $ldap = new Client;
         $ldap->open('my_ldap_server');
@@ -221,7 +222,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_server'),
                 $this->equalTo(389)
             )
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         self::$functions
             ->expects($this->once())
@@ -231,7 +232,7 @@ class ClientTest extends Base
                 $this->equalTo('my_ldap_user'),
                 $this->equalTo('my_ldap_password')
             )
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->expectException('\Kanboard\Core\Ldap\ClientException');
 
diff --git a/tests/units/Core/Ldap/LdapGroupTest.php b/tests/units/Core/Ldap/LdapGroupTest.php
index af42f82..5c83df6 100644
--- a/tests/units/Core/Ldap/LdapGroupTest.php
+++ b/tests/units/Core/Ldap/LdapGroupTest.php
@@ -70,7 +70,7 @@ class LdapGroupTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -83,22 +83,22 @@ class LdapGroupTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->group
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('cn'));
+            ->willReturn('cn');
 
         $this->group
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('CN=Users,DC=kanboard,DC=local'));
+            ->willReturn('CN=Users,DC=kanboard,DC=local');
 
         $groups = $this->group->find('(&(objectClass=group)(sAMAccountName=Kanboard*))');
         $this->assertCount(2, $groups);
@@ -117,7 +117,7 @@ class LdapGroupTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -130,7 +130,7 @@ class LdapGroupTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->query
             ->expects($this->never())
@@ -139,12 +139,12 @@ class LdapGroupTest extends Base
         $this->group
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('cn'));
+            ->willReturn('cn');
 
         $this->group
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('CN=Users,DC=kanboard,DC=local'));
+            ->willReturn('CN=Users,DC=kanboard,DC=local');
 
         $groups = $this->group->find('(&(objectClass=group)(sAMAccountName=Kanboard*))');
         $this->assertCount(0, $groups);
diff --git a/tests/units/Core/Ldap/LdapUserTest.php b/tests/units/Core/Ldap/LdapUserTest.php
index 58d84a0..4a34eb0 100644
--- a/tests/units/Core/Ldap/LdapUserTest.php
+++ b/tests/units/Core/Ldap/LdapUserTest.php
@@ -91,7 +91,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -104,32 +104,32 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeUsername')
-            ->will($this->returnValue('samaccountname'));
+            ->willReturn('samaccountname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('displayname'));
+            ->willReturn('displayname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeEmail')
-            ->will($this->returnValue('mail'));
+            ->willReturn('mail');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('ou=People,dc=kanboard,dc=local'));
+            ->willReturn('ou=People,dc=kanboard,dc=local');
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertInstanceOf('Kanboard\User\LdapUserProvider', $user);
@@ -176,7 +176,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -189,22 +189,22 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->user
             ->expects($this->any())
             ->method('getAttributePhoto')
-            ->will($this->returnValue('jpegPhoto'));
+            ->willReturn('jpegPhoto');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('ou=People,dc=kanboard,dc=local'));
+            ->willReturn('ou=People,dc=kanboard,dc=local');
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertInstanceOf('Kanboard\User\LdapUserProvider', $user);
@@ -247,7 +247,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -260,42 +260,42 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeUsername')
-            ->will($this->returnValue('samaccountname'));
+            ->willReturn('samaccountname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('displayname'));
+            ->willReturn('displayname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeEmail')
-            ->will($this->returnValue('mail'));
+            ->willReturn('mail');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeGroup')
-            ->will($this->returnValue('memberof'));
+            ->willReturn('memberof');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupAdminDn')
-            ->will($this->returnValue('CN=Kanboard-Admins,CN=Users,DC=kanboard,DC=local'));
+            ->willReturn('CN=Kanboard-Admins,CN=Users,DC=kanboard,DC=local');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('ou=People,dc=kanboard,dc=local'));
+            ->willReturn('ou=People,dc=kanboard,dc=local');
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertInstanceOf('Kanboard\User\LdapUserProvider', $user);
@@ -350,7 +350,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -363,42 +363,42 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeUsername')
-            ->will($this->returnValue('samaccountname'));
+            ->willReturn('samaccountname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('displayname'));
+            ->willReturn('displayname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeEmail')
-            ->will($this->returnValue('mail'));
+            ->willReturn('mail');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeGroup')
-            ->will($this->returnValue('memberof'));
+            ->willReturn('memberof');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupManagerDn')
-            ->will($this->returnValue('CN=Kanboard-Managers,CN=Users,DC=kanboard,DC=local'));
+            ->willReturn('CN=Kanboard-Managers,CN=Users,DC=kanboard,DC=local');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('ou=People,dc=kanboard,dc=local'));
+            ->willReturn('ou=People,dc=kanboard,dc=local');
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertInstanceOf('Kanboard\User\LdapUserProvider', $user);
@@ -416,7 +416,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -429,7 +429,7 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->query
             ->expects($this->never())
@@ -438,22 +438,22 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getAttributeUsername')
-            ->will($this->returnValue('samaccountname'));
+            ->willReturn('samaccountname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('displayname'));
+            ->willReturn('displayname');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeEmail')
-            ->will($this->returnValue('mail'));
+            ->willReturn('mail');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('ou=People,dc=kanboard,dc=local'));
+            ->willReturn('ou=People,dc=kanboard,dc=local');
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertEquals(null, $user);
@@ -492,7 +492,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -505,53 +505,53 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeUsername')
-            ->will($this->returnValue('uid'));
+            ->willReturn('uid');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('cn'));
+            ->willReturn('cn');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeEmail')
-            ->will($this->returnValue('mail'));
+            ->willReturn('mail');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeGroup')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupUserFilter')
-            ->will($this->returnValue('(&(objectClass=posixGroup)(memberUid=%s))'));
+            ->willReturn('(&(objectClass=posixGroup)(memberUid=%s))');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupAdminDn')
-            ->will($this->returnValue('cn=Kanboard Admins,ou=Groups,dc=kanboard,dc=local'));
+            ->willReturn('cn=Kanboard Admins,ou=Groups,dc=kanboard,dc=local');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('OU=Users,DC=kanboard,DC=local'));
+            ->willReturn('OU=Users,DC=kanboard,DC=local');
 
         $this->group
             ->expects($this->once())
             ->method('find')
             ->with('(&(objectClass=posixGroup)(memberUid=my_ldap_user))')
-            ->will($this->returnValue($groups));
+            ->willReturn($groups);
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertInstanceOf('Kanboard\User\LdapUserProvider', $user);
@@ -598,7 +598,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -611,53 +611,53 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeUsername')
-            ->will($this->returnValue('uid'));
+            ->willReturn('uid');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('cn'));
+            ->willReturn('cn');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeEmail')
-            ->will($this->returnValue('mail'));
+            ->willReturn('mail');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeGroup')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupUserFilter')
-            ->will($this->returnValue('(&(objectClass=posixGroup)(memberUid=%s))'));
+            ->willReturn('(&(objectClass=posixGroup)(memberUid=%s))');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupManagerDn')
-            ->will($this->returnValue('cn=Kanboard Managers,ou=Groups,dc=kanboard,dc=local'));
+            ->willReturn('cn=Kanboard Managers,ou=Groups,dc=kanboard,dc=local');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('OU=Users,DC=kanboard,DC=local'));
+            ->willReturn('OU=Users,DC=kanboard,DC=local');
 
         $this->group
             ->expects($this->once())
             ->method('find')
             ->with('(&(objectClass=posixGroup)(memberUid=my_ldap_user))')
-            ->will($this->returnValue($groups));
+            ->willReturn($groups);
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertInstanceOf('Kanboard\User\LdapUserProvider', $user);
@@ -709,7 +709,7 @@ class LdapUserTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         $this->query
             ->expects($this->once())
@@ -722,53 +722,53 @@ class LdapUserTest extends Base
         $this->query
             ->expects($this->once())
             ->method('hasResult')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->query
             ->expects($this->once())
             ->method('getEntries')
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeUsername')
-            ->will($this->returnValue('uid'));
+            ->willReturn('uid');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeName')
-            ->will($this->returnValue('cn'));
+            ->willReturn('cn');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeEmail')
-            ->will($this->returnValue('mail'));
+            ->willReturn('mail');
 
         $this->user
             ->expects($this->any())
             ->method('getAttributeGroup')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupUserFilter')
-            ->will($this->returnValue('(&(objectClass=posixGroup)(memberUid=%s))'));
+            ->willReturn('(&(objectClass=posixGroup)(memberUid=%s))');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupManagerDn')
-            ->will($this->returnValue('cn=Kanboard Managers,ou=Groups,dc=kanboard,dc=local'));
+            ->willReturn('cn=Kanboard Managers,ou=Groups,dc=kanboard,dc=local');
 
         $this->user
             ->expects($this->any())
             ->method('getBaseDn')
-            ->will($this->returnValue('OU=Users,DC=kanboard,DC=local'));
+            ->willReturn('OU=Users,DC=kanboard,DC=local');
 
         $this->group
             ->expects($this->once())
             ->method('find')
             ->with('(&(objectClass=posixGroup)(memberUid=my_ldap_user))')
-            ->will($this->returnValue($groups));
+            ->willReturn($groups);
 
         $user = $this->user->find('(uid=my_ldap_user)');
         $this->assertInstanceOf('Kanboard\User\LdapUserProvider', $user);
@@ -823,7 +823,7 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getGroupUserFilter')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->assertFalse($this->user->hasGroupUserFilter());
     }
@@ -833,7 +833,7 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getGroupUserFilter')
-            ->will($this->returnValue(null));
+            ->willReturn(null);
 
         $this->assertFalse($this->user->hasGroupUserFilter());
     }
@@ -843,7 +843,7 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getGroupUserFilter')
-            ->will($this->returnValue('foobar'));
+            ->willReturn('foobar');
 
         $this->assertTrue($this->user->hasGroupUserFilter());
     }
@@ -853,12 +853,12 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getGroupAdminDn')
-            ->will($this->returnValue('something'));
+            ->willReturn('something');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupManagerDn')
-            ->will($this->returnValue('something'));
+            ->willReturn('something');
 
         $this->assertTrue($this->user->hasGroupsConfigured());
     }
@@ -868,12 +868,12 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getGroupAdminDn')
-            ->will($this->returnValue('something'));
+            ->willReturn('something');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupManagerDn')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->assertTrue($this->user->hasGroupsConfigured());
     }
@@ -883,12 +883,12 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getGroupAdminDn')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupManagerDn')
-            ->will($this->returnValue('something'));
+            ->willReturn('something');
 
         $this->assertTrue($this->user->hasGroupsConfigured());
     }
@@ -898,12 +898,12 @@ class LdapUserTest extends Base
         $this->user
             ->expects($this->any())
             ->method('getGroupAdminDn')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->user
             ->expects($this->any())
             ->method('getGroupManagerDn')
-            ->will($this->returnValue(''));
+            ->willReturn('');
 
         $this->assertFalse($this->user->hasGroupsConfigured());
     }
diff --git a/tests/units/Core/Ldap/QueryTest.php b/tests/units/Core/Ldap/QueryTest.php
index 2872475..d59bc43 100644
--- a/tests/units/Core/Ldap/QueryTest.php
+++ b/tests/units/Core/Ldap/QueryTest.php
@@ -19,6 +19,7 @@ namespace KanboardTests\units\Core\Ldap;
 use Kanboard\Core\Ldap\Query;
 use KanboardTests\units\Base;
 
+#[\PHPUnit\Framework\Attributes\RequiresPhpunit('< 12')]
 class QueryTest extends Base
 {
     public static $functions;
@@ -74,7 +75,7 @@ class QueryTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         self::$functions
             ->expects($this->once())
@@ -85,7 +86,7 @@ class QueryTest extends Base
                 $this->equalTo('uid=my_user'),
                 $this->equalTo(array('displayname'))
             )
-            ->will($this->returnValue('search_resource'));
+            ->willReturn('search_resource');
 
         self::$functions
             ->expects($this->once())
@@ -94,7 +95,7 @@ class QueryTest extends Base
                 $this->equalTo('my_ldap_resource'),
                 $this->equalTo('search_resource')
             )
-            ->will($this->returnValue($entries));
+            ->willReturn($entries);
 
         $query = new Query($this->client);
         $query->execute('ou=People,dc=kanboard,dc=local', 'uid=my_user', array('displayname'));
@@ -113,7 +114,7 @@ class QueryTest extends Base
         $this->client
             ->expects($this->any())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         self::$functions
             ->expects($this->once())
@@ -124,7 +125,7 @@ class QueryTest extends Base
                 $this->equalTo('uid=my_user'),
                 $this->equalTo(array('displayname'))
             )
-            ->will($this->returnValue('search_resource'));
+            ->willReturn('search_resource');
 
         self::$functions
             ->expects($this->once())
@@ -133,7 +134,7 @@ class QueryTest extends Base
                 $this->equalTo('my_ldap_resource'),
                 $this->equalTo('search_resource')
             )
-            ->will($this->returnValue(array()));
+            ->willReturn(array());
 
         $query = new Query($this->client);
         $query->execute('ou=People,dc=kanboard,dc=local', 'uid=my_user', array('displayname'));
@@ -145,7 +146,7 @@ class QueryTest extends Base
         $this->client
             ->expects($this->once())
             ->method('getConnection')
-            ->will($this->returnValue('my_ldap_resource'));
+            ->willReturn('my_ldap_resource');
 
         self::$functions
             ->expects($this->once())
@@ -156,7 +157,7 @@ class QueryTest extends Base
                 $this->equalTo('uid=my_user'),
                 $this->equalTo(array('displayname'))
             )
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $query = new Query($this->client);
         $query->execute('ou=People,dc=kanboard,dc=local', 'uid=my_user', array('displayname'));
diff --git a/tests/units/Core/Plugin/DirectoryTest.php b/tests/units/Core/Plugin/DirectoryTest.php
index 8f6ac06..8193558 100644
--- a/tests/units/Core/Plugin/DirectoryTest.php
+++ b/tests/units/Core/Plugin/DirectoryTest.php
@@ -39,7 +39,7 @@ class DirectoryTest extends Base
             ->expects($this->once())
             ->method('getJson')
             ->with('api_url')
-            ->will($this->returnValue($plugins));
+            ->willReturn($plugins);
 
         $pluginDirectory = new Directory($this->container);
         $availablePlugins = $pluginDirectory->getAvailablePlugins('api_url');
diff --git a/tests/units/Decorator/MetadataCacheDecoratorTest.php b/tests/units/Decorator/MetadataCacheDecoratorTest.php
index b6dae57..92bd2b6 100644
--- a/tests/units/Decorator/MetadataCacheDecoratorTest.php
+++ b/tests/units/Decorator/MetadataCacheDecoratorTest.php
@@ -11,12 +11,12 @@ class MetadataCacheDecoratorTest extends Base
     protected $entityId = 123;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \PHPUnit\Framework\MockObject\MockObject
      */
     protected $cacheMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \PHPUnit\Framework\MockObject\MockObject
      */
     protected $metadataModelMock;
 
@@ -80,7 +80,7 @@ class MetadataCacheDecoratorTest extends Base
             ->expects($this->once())
             ->method('get')
             ->with($this->cachePrefix.$this->entityId)
-            ->will($this->returnValue(array('key' => 'foobar')))
+            ->willReturn(array('key' => 'foobar'))
         ;
 
         $this->assertEquals('foobar', $this->metadataCacheDecorator->get('key', 'default'));
@@ -92,7 +92,7 @@ class MetadataCacheDecoratorTest extends Base
             ->expects($this->once())
             ->method('get')
             ->with($this->cachePrefix.$this->entityId)
-            ->will($this->returnValue(array('key1' => 'foobar')))
+            ->willReturn(array('key1' => 'foobar'))
         ;
 
         $this->assertEquals('default', $this->metadataCacheDecorator->get('key', 'default'));
@@ -104,7 +104,7 @@ class MetadataCacheDecoratorTest extends Base
             ->expects($this->once())
             ->method('get')
             ->with($this->cachePrefix.$this->entityId)
-            ->will($this->returnValue(null))
+            ->willReturn(null)
         ;
 
         $this->cacheMock
@@ -120,7 +120,7 @@ class MetadataCacheDecoratorTest extends Base
             ->expects($this->once())
             ->method('getAll')
             ->with($this->entityId)
-            ->will($this->returnValue(array('key' => 'something')))
+            ->willReturn(array('key' => 'something'))
         ;
 
         $this->assertEquals('something', $this->metadataCacheDecorator->get('key', 'default'));
diff --git a/tests/units/ExternalLink/WebLinkTest.php b/tests/units/ExternalLink/WebLinkTest.php
index 4df91b6..1dea9cd 100644
--- a/tests/units/ExternalLink/WebLinkTest.php
+++ b/tests/units/ExternalLink/WebLinkTest.php
@@ -21,7 +21,7 @@ class WebLinkTest extends Base
             ->expects($this->once())
             ->method('get')
             ->with($url)
-            ->will($this->returnValue($html));
+            ->willReturn($html);
 
         $this->assertEquals($title, $webLink->getTitle());
     }
@@ -39,7 +39,7 @@ class WebLinkTest extends Base
             ->expects($this->once())
             ->method('get')
             ->with($url)
-            ->will($this->returnValue($html));
+            ->willReturn($html);
 
         $this->assertEquals('kanboard.org/something', $webLink->getTitle());
     }
diff --git a/tests/units/Helper/HookHelperTest.php b/tests/units/Helper/HookHelperTest.php
index 6701425..270f535 100644
--- a/tests/units/Helper/HookHelperTest.php
+++ b/tests/units/Helper/HookHelperTest.php
@@ -22,7 +22,7 @@ class HookHelperTest extends Base
                 $this->equalTo('tpl1'),
                 $this->equalTo(array('k0' => 'v0', 'k1' => 'v1'))
             )
-            ->will($this->returnValue('tpl1_content'));
+            ->willReturn('tpl1_content');
 
         $hookHelper = new HookHelper($this->container);
         $hookHelper->attachCallable('test', 'tpl1', function () {
@@ -49,7 +49,7 @@ class HookHelperTest extends Base
                 $this->equalTo('tpl1'),
                 $this->equalTo(array('k0' => 'v0'))
             )
-            ->will($this->returnValue('tpl1_content'));
+            ->willReturn('tpl1_content');
 
         $hookHelper = new HookHelper($this->container);
         $hookHelper->attachCallable('test', 'tpl1', function () {
@@ -73,7 +73,7 @@ class HookHelperTest extends Base
                 $this->equalTo('tpl1'),
                 $this->equalTo(array('k0' => 'v0', 'k1' => 'v1'))
             )
-            ->will($this->returnValue('tpl1_content'));
+            ->willReturn('tpl1_content');
 
         $hookHelper = new HookHelper($this->container);
         $hookHelper->attach('test', 'tpl1', array('k1' => 'v1'));
@@ -117,7 +117,7 @@ class HookHelperTest extends Base
             ->with(
                 $this->equalTo('skin.css')
             )
-            ->will($this->returnValue('<link rel="stylesheet" href="skin.css"></link>'));
+            ->willReturn('<link rel="stylesheet" href="skin.css"></link>');
 
         $this->container['helper']
             ->asset
@@ -126,7 +126,7 @@ class HookHelperTest extends Base
             ->with(
                 $this->equalTo('skin.js')
             )
-            ->will($this->returnValue('<script src="skin.js"></script>'));
+            ->willReturn('<script src="skin.js"></script>');
 
         $hookHelper = new HookHelper($this->container);
         $hookHelper->attach('test1', 'skin.css');
diff --git a/tests/units/Job/CommentEventJobTest.php b/tests/units/Job/CommentEventJobTest.php
index b68ec86..94eab8e 100644
--- a/tests/units/Job/CommentEventJobTest.php
+++ b/tests/units/Job/CommentEventJobTest.php
@@ -80,7 +80,7 @@ class CommentEventJobTest extends Base
             ->expects($this->once())
             ->method('withParams')
             ->with($comment, CommentModel::EVENT_USER_MENTION, $this->anything())
-            ->will($this->returnValue($this->container['userMentionJob']));
+            ->willReturn($this->container['userMentionJob']);
 
         $commentModel = new CommentModel($this->container);
         $taskCreationModel = new TaskCreationModel($this->container);
diff --git a/tests/units/Job/TaskEventJobTest.php b/tests/units/Job/TaskEventJobTest.php
index 718b132..5a9fcc5 100644
--- a/tests/units/Job/TaskEventJobTest.php
+++ b/tests/units/Job/TaskEventJobTest.php
@@ -214,7 +214,7 @@ class TaskEventJobTest extends Base
             ->expects($this->once())
             ->method('withParams')
             ->with($description, TaskModel::EVENT_USER_MENTION, $this->anything())
-            ->will($this->returnValue($this->container['userMentionJob']));
+            ->willReturn($this->container['userMentionJob']);
 
         $taskCreationModel = new TaskCreationModel($this->container);
         $projectModel = new ProjectModel($this->container);
diff --git a/tests/units/Middleware/ApplicationAuthorizationMiddlewareTest.php b/tests/units/Middleware/ApplicationAuthorizationMiddlewareTest.php
index 32a0d68..b269b74 100644
--- a/tests/units/Middleware/ApplicationAuthorizationMiddlewareTest.php
+++ b/tests/units/Middleware/ApplicationAuthorizationMiddlewareTest.php
@@ -41,7 +41,7 @@ class ApplicationAuthorizationMiddlewareTest extends Base
         $this->container['helper']->user
             ->expects($this->once())
             ->method('hasAccess')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->nextMiddleware
             ->expects($this->never())
@@ -56,7 +56,7 @@ class ApplicationAuthorizationMiddlewareTest extends Base
         $this->container['helper']->user
             ->expects($this->once())
             ->method('hasAccess')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->nextMiddleware
             ->expects($this->once())
diff --git a/tests/units/Middleware/AuthenticationMiddlewareTest.php b/tests/units/Middleware/AuthenticationMiddlewareTest.php
index 9fb5b73..07e1630 100644
--- a/tests/units/Middleware/AuthenticationMiddlewareTest.php
+++ b/tests/units/Middleware/AuthenticationMiddlewareTest.php
@@ -5,6 +5,7 @@ namespace KanboardTests\units\Middleware;
 use KanboardTests\units\Base;
 use Kanboard\Middleware\AuthenticationMiddleware;
 
+#[\PHPUnit\Framework\Attributes\RequiresPhpunit('< 12')]
 class AuthenticationMiddlewareTest extends Base
 {
     /**
@@ -55,7 +56,7 @@ class AuthenticationMiddlewareTest extends Base
         $this->container['authenticationManager']
             ->expects($this->once())
             ->method('checkCurrentSession')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->nextMiddleware
             ->expects($this->never())
@@ -69,12 +70,12 @@ class AuthenticationMiddlewareTest extends Base
         $this->container['authenticationManager']
             ->expects($this->once())
             ->method('checkCurrentSession')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->container['applicationAuthorization']
             ->expects($this->once())
             ->method('isAllowed')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->nextMiddleware
             ->expects($this->never())
@@ -88,17 +89,17 @@ class AuthenticationMiddlewareTest extends Base
         $this->container['authenticationManager']
             ->expects($this->once())
             ->method('checkCurrentSession')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->container['applicationAuthorization']
             ->expects($this->once())
             ->method('isAllowed')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->container['userSession']
             ->expects($this->once())
             ->method('isLogged')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->container['response']
             ->expects($this->once())
@@ -116,17 +117,17 @@ class AuthenticationMiddlewareTest extends Base
         $this->container['authenticationManager']
             ->expects($this->once())
             ->method('checkCurrentSession')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->container['applicationAuthorization']
             ->expects($this->once())
             ->method('isAllowed')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->container['userSession']
             ->expects($this->once())
             ->method('isLogged')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->container['response']
             ->expects($this->never())
diff --git a/tests/units/Middleware/ProjectAuthorizationMiddlewareTest.php b/tests/units/Middleware/ProjectAuthorizationMiddlewareTest.php
index 1d18268..6adfec8 100644
--- a/tests/units/Middleware/ProjectAuthorizationMiddlewareTest.php
+++ b/tests/units/Middleware/ProjectAuthorizationMiddlewareTest.php
@@ -47,12 +47,12 @@ class ProjectAuthorizationMiddlewareTest extends Base
         $this->container['request']
             ->expects($this->any())
             ->method('getIntegerParam')
-            ->will($this->returnValue(123));
+            ->willReturn(123);
 
         $this->container['helper']->user
             ->expects($this->once())
             ->method('hasProjectAccess')
-            ->will($this->returnValue(false));
+            ->willReturn(false);
 
         $this->nextMiddleware
             ->expects($this->never())
@@ -67,12 +67,12 @@ class ProjectAuthorizationMiddlewareTest extends Base
         $this->container['request']
             ->expects($this->any())
             ->method('getIntegerParam')
-            ->will($this->returnValue(123));
+            ->willReturn(123);
 
         $this->container['helper']->user
             ->expects($this->once())
             ->method('hasProjectAccess')
-            ->will($this->returnValue(true));
+            ->willReturn(true);
 
         $this->nextMiddleware
             ->expects($this->once())
diff --git a/tests/units/Model/UserNotificationTest.php b/tests/units/Model/UserNotificationTest.php
index 05b8e1e..61cd407 100644
--- a/tests/units/Model/UserNotificationTest.php
+++ b/tests/units/Model/UserNotificationTest.php
@@ -173,6 +173,7 @@ class UserNotificationTest extends Base
         $this->assertEquals('user3@here', $users[2]['email']);
     }
 
+    #[\PHPUnit\Framework\Attributes\RequiresPhpunit('< 12')]
     public function testSendNotifications()
     {
         $userModel = new UserModel($this->container);
@@ -205,7 +206,7 @@ class UserNotificationTest extends Base
         $this->container['userNotificationTypeModel']
             ->expects($this->once())
             ->method('getSelectedTypes')
-            ->will($this->returnValue(array('email', 'web')));
+            ->willReturn(array('email', 'web'));
 
         $series = [
             [['email'], $notifier],
