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

@@ -1,6 +1,6 @@
<?php
class DefaultConfigFileTest extends PHPUnit_Framework_TestCase
class DefaultConfigFileTest extends PHPUnit\Framework\TestCase
{
public function testThatFileCanBeImported()
{

View File

@@ -6,25 +6,25 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
{
public function testApiCredentialDoNotHaveAccessToUserCredentialProcedure()
{
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->app->getMe();
}
public function testUserCredentialDoNotHaveAccessToAdminProcedures()
{
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->getUser(1);
}
public function testManagerCredentialDoNotHaveAccessToAdminProcedures()
{
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->getAllProjects();
}
public function testUserCredentialDoNotHaveAccessToManagerProcedures()
{
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->createProject('Team project creation are only for app managers');
}
@@ -38,7 +38,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$projectId = $this->admin->createProject('Team project created by admin');
$this->assertNotFalse($projectId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->assertNotNull($this->manager->getProjectById($projectId));
}
@@ -61,7 +61,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$projectId = $this->manager->createProject('A team project without members');
$this->assertNotFalse($projectId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->getProjectById($projectId);
}
@@ -90,7 +90,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$actionId = $this->manager->createAction($projectId, 'task.move.column', '\Kanboard\Action\TaskCloseColumn', array('column_id' => 1));
$this->assertNotFalse($actionId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeAction($projectId);
}
@@ -108,7 +108,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member'));
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeAction($actionId);
}
@@ -140,7 +140,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$categoryId = $this->manager->createCategory($projectId, 'Test');
$this->assertNotFalse($categoryId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeCategory($categoryId);
}
@@ -157,7 +157,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$this->assertNotFalse($categoryId);
$this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member'));
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeCategory($categoryId);
}
@@ -189,7 +189,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$columnId = $this->manager->addColumn($projectId, 'Test');
$this->assertNotFalse($columnId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeColumn($columnId);
}
@@ -206,7 +206,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$this->assertNotFalse($columnId);
$this->assertTrue($this->manager->addProjectUser($projectId, $this->userUserId, 'project-member'));
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeColumn($columnId);
}
@@ -242,7 +242,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$commentId = $this->manager->createComment($taskId, $this->userUserId, 'My comment');
$this->assertNotFalse($commentId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->updateComment($commentId, 'something else');
}
@@ -281,7 +281,7 @@ class ProcedureAuthorizationTest extends BaseProcedureTest
$subtaskId = $this->manager->createSubtask($taskId, 'My subtask');
$this->assertNotFalse($subtaskId);
$this->setExpectedException('JsonRPC\Exception\AccessDeniedException');
$this->expectException('JsonRPC\Exception\AccessDeniedException');
$this->user->removeSubtask($subtaskId);
}

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']);
}
}