Kanboard now requires PHP >= 7.2 since other versions are deprecated

This commit is contained in:
Timo
2020-01-14 21:02:31 +01:00
committed by Frédéric Guillot
parent 7731dde413
commit 64397f45fa
39 changed files with 520 additions and 363 deletions

View File

@@ -11,7 +11,7 @@ use Kanboard\Core\Log\Logger;
use Kanboard\Core\Session\FlashMessage;
use Kanboard\ServiceProvider\ActionProvider;
abstract class Base extends PHPUnit_Framework_TestCase
abstract class Base extends PHPUnit\Framework\TestCase
{
protected $container;

View File

@@ -26,7 +26,7 @@ class ActionManagerTest extends Base
public function testGetActionNotFound()
{
$this->setExpectedException('RuntimeException', 'Automatic Action Not Found: foobar');
$this->expectException('RuntimeException', 'Automatic Action Not Found: foobar');
$actionManager = new ActionManager($this->container);
$actionManager->getAction('foobar');
}

View File

@@ -25,7 +25,7 @@ class ExternalLinkManagerTest extends Base
{
$externalLinkManager = new ExternalLinkManager($this->container);
$this->setExpectedException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$this->expectException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$externalLinkManager->getProvider('not found');
}
@@ -68,7 +68,7 @@ class ExternalLinkManagerTest extends Base
$externalLinkManager->register($webLinkProvider);
$externalLinkManager->register($attachmentLinkProvider);
$this->setExpectedException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$this->expectException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$externalLinkManager->find();
}
@@ -113,7 +113,7 @@ class ExternalLinkManagerTest extends Base
$externalLinkManager->register($webLinkProvider);
$externalLinkManager->register($attachmentLinkProvider);
$this->setExpectedException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$this->expectException('\Kanboard\Core\ExternalLink\ExternalLinkProviderNotFound');
$externalLinkManager->setUserInput(array('text' => 'https://google.com/', 'type' => 'not found'));
$externalLinkManager->find();
}

View File

@@ -8,7 +8,7 @@ class ExternalTaskManagerTest extends Base
{
public function testProviderNotFound()
{
$this->setExpectedException('Kanboard\Core\ExternalTask\ProviderNotFoundException');
$this->expectException('Kanboard\Core\ExternalTask\ProviderNotFoundException');
$manager = new ExternalTaskManager();
$manager->getProvider('foobar');

View File

@@ -68,7 +68,7 @@ class ClientTest extends \Base
public function testGetLdapServerNotConfigured()
{
$this->setExpectedException('\LogicException');
$this->expectException('\LogicException');
$ldap = new Client;
$ldap->getLdapServer();
}
@@ -100,7 +100,7 @@ class ClientTest extends \Base
)
->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ConnectionException');
$this->expectException('\Kanboard\Core\Ldap\ConnectionException');
$ldap = new Client;
$ldap->open('my_ldap_server');
@@ -150,7 +150,7 @@ class ClientTest extends \Base
)
->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ConnectionException');
$this->expectException('\Kanboard\Core\Ldap\ConnectionException');
$ldap = new Client;
$ldap->open('my_ldap_server', 389, true);
@@ -175,7 +175,7 @@ class ClientTest extends \Base
->method('ldap_bind')
->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ClientException');
$this->expectException('\Kanboard\Core\Ldap\ClientException');
$ldap = new Client;
$ldap->useAnonymousAuthentication();
@@ -228,7 +228,7 @@ class ClientTest extends \Base
)
->will($this->returnValue(false));
$this->setExpectedException('\Kanboard\Core\Ldap\ClientException');
$this->expectException('\Kanboard\Core\Ldap\ClientException');
$ldap = new Client;
$ldap->open('my_ldap_server');

View File

@@ -151,7 +151,7 @@ class LdapGroupTest extends Base
public function testGetBaseDnNotConfigured()
{
$this->setExpectedException('\LogicException');
$this->expectException('\LogicException');
$group = new Group($this->query);
$group->getBasDn();

View File

@@ -787,7 +787,7 @@ class LdapUserTest extends Base
public function testGetBaseDnNotConfigured()
{
$this->setExpectedException('\LogicException');
$this->expectException('\LogicException');
$user = new User($this->query);
$user->getBasDn();
@@ -795,7 +795,7 @@ class LdapUserTest extends Base
public function testGetLdapUserPatternNotConfigured()
{
$this->setExpectedException('\LogicException');
$this->expectException('\LogicException');
$user = new User($this->query);
$user->getLdapUserPattern('test');

View File

@@ -22,14 +22,14 @@ class AuthenticationManagerTest extends Base
public function testGetProviderNotFound()
{
$authManager = new AuthenticationManager($this->container);
$this->setExpectedException('LogicException');
$this->expectException('LogicException');
$authManager->getProvider('Dababase');
}
public function testGetPostProviderNotFound()
{
$authManager = new AuthenticationManager($this->container);
$this->setExpectedException('LogicException');
$this->expectException('LogicException');
$authManager->getPostAuthenticationProvider();
}

View File

@@ -8,7 +8,7 @@ class LdapBackendGroupProviderTest extends Base
{
public function testGetLdapGroupPattern()
{
$this->setExpectedException('LogicException', 'LDAP group filter empty, check the parameter LDAP_GROUP_FILTER');
$this->expectException('LogicException', 'LDAP group filter empty, check the parameter LDAP_GROUP_FILTER');
$backend = new LdapBackendGroupProvider($this->container);
$backend->getLdapGroupPattern('test');

View File

@@ -45,7 +45,7 @@ class ApplicationAuthorizationMiddlewareMiddlewareTest extends Base
->expects($this->never())
->method('execute');
$this->setExpectedException('Kanboard\Core\Controller\AccessForbiddenException');
$this->expectException('Kanboard\Core\Controller\AccessForbiddenException');
$this->middleware->execute();
}

View File

@@ -56,7 +56,7 @@ class ProjectAuthorizationMiddlewareMiddlewareTest extends Base
->expects($this->never())
->method('execute');
$this->setExpectedException('Kanboard\Core\Controller\AccessForbiddenException');
$this->expectException('Kanboard\Core\Controller\AccessForbiddenException');
$this->middleware->execute();
}

View File

@@ -388,10 +388,10 @@ class UserModelTest extends Base
$projectModel = new ProjectModel($this->container);
$this->assertEquals(2, $userModel->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
$this->assertEquals(1, $projectModel->create(array('name' => 'Project #1', 'is_private' => 1, 'owner_id' => 2)));
$this->assertEquals(1, $projectModel->create(array('name' => 'Project #1', 'is_private' => 1), 2));
$this->assertTrue($userModel->disable(2));
$project = $projectModel->getById(2);
$project = $projectModel->getById(1);
$this->assertEquals(0, $project['is_active']);
}
}