Release 2.12 (#4609)

This commit is contained in:
Kevin Papst
2024-02-07 23:47:25 +01:00
committed by GitHub
parent 7abe787778
commit 85a16a9363
394 changed files with 1189 additions and 6735 deletions

View File

@@ -1,17 +1,5 @@
name-template: '$RESOLVED_VERSION' name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION' tag-template: '$RESOLVED_VERSION'
categories:
- title: 'Enhancements'
labels:
- 'feature request'
- 'technical debt'
- 'translation'
- title: 'Fixed bugs'
labels:
- 'bug'
- title: 'Infrastructure'
labels:
- 'infrastructure'
exclude-labels: exclude-labels:
- 'duplicate' - 'duplicate'
- 'invalid' - 'invalid'

View File

@@ -42,7 +42,7 @@ final class Version20230126002049 extends AbstractMigration
$users = $schema->getTable('kimai2_users'); $users = $schema->getTable('kimai2_users');
if (!$users->hasColumn('totp_secret')) { if (!$users->hasColumn('totp_secret')) {
$users->addColumn('totp_secret', 'string', ['notnull' => false, 'default' => null]); $users->addColumn('totp_secret', 'string', ['length' => 255, 'notnull' => false, 'default' => null]);
$users->addColumn('totp_enabled', 'boolean', ['notnull' => true, 'default' => false]); $users->addColumn('totp_enabled', 'boolean', ['notnull' => true, 'default' => false]);
} }
if (!$users->hasColumn('system_account')) { if (!$users->hasColumn('system_account')) {

View File

@@ -51,7 +51,7 @@ final class LocaleService
public function isKnownLocale(string $language): bool public function isKnownLocale(string $language): bool
{ {
return \in_array($language, $this->getAllLocales()); return \in_array($language, $this->getAllLocales(), true);
} }
/** /**

View File

@@ -17,11 +17,11 @@ class Constants
/** /**
* The current release version * The current release version
*/ */
public const VERSION = '2.11.0'; public const VERSION = '2.12.0';
/** /**
* The current release: major * 10000 + minor * 100 + patch * The current release: major * 10000 + minor * 100 + patch
*/ */
public const VERSION_ID = 21100; public const VERSION_ID = 21200;
/** /**
* The software name * The software name
*/ */

View File

@@ -15,12 +15,16 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Http\SecurityRequestAttributes; use Symfony\Component\Security\Http\SecurityRequestAttributes;
#[Route(path: '/saml')] #[Route(path: '/saml')]
final class SamlController extends AbstractController final class SamlController extends AbstractController
{ {
public function __construct(private SamlAuthFactory $authFactory, private SamlConfigurationInterface $samlConfiguration) public function __construct(
private readonly SamlAuthFactory $authFactory,
private readonly SamlConfigurationInterface $samlConfiguration
)
{ {
} }
@@ -51,7 +55,12 @@ final class SamlController extends AbstractController
} }
// this does set headers and exit as $stay is not set to true // this does set headers and exit as $stay is not set to true
$url = $this->authFactory->create()->login($session->get('_security.main.target_path')); $redirectTarget = $session->get('_security.main.target_path');
if ($redirectTarget === null || $redirectTarget === '') {
$redirectTarget = $this->generateUrl('homepage', [], UrlGeneratorInterface::ABSOLUTE_URL);
}
$url = $this->authFactory->create()->login($redirectTarget);
if ($url === null) { if ($url === null) {
throw new \RuntimeException('SAML login failed'); throw new \RuntimeException('SAML login failed');

View File

@@ -209,8 +209,9 @@ class User implements UserInterface, EquatableInterface, ThemeUserInterface, Pas
private array $roles = []; private array $roles = [];
/** /**
* If not empty two-factor authentication is enabled. * If not empty two-factor authentication is enabled.
* TODO reduce the length, which was initially forgotten and set to 255, as this is the default for MySQL with Doctrine (see migration Version20230126002049)
*/ */
#[ORM\Column(name: 'totp_secret', type: 'string', nullable: true)] #[ORM\Column(name: 'totp_secret', type: 'string', length: 255, nullable: true)]
private ?string $totpSecret = null; private ?string $totpSecret = null;
#[ORM\Column(name: 'totp_enabled', type: 'boolean', nullable: false, options: ['default' => false])] #[ORM\Column(name: 'totp_enabled', type: 'boolean', nullable: false, options: ['default' => false])]
private bool $totpEnabled = false; private bool $totpEnabled = false;
@@ -1287,9 +1288,11 @@ class User implements UserInterface, EquatableInterface, ThemeUserInterface, Pas
return $group === null ? $group : (string) $group; return $group === null ? $group : (string) $group;
} }
public function getHolidaysPerYear(): int public function getHolidaysPerYear(): float
{ {
return (int) $this->getPreferenceValue(UserPreference::HOLIDAYS_PER_YEAR, 0); $holidays = $this->getPreferenceValue(UserPreference::HOLIDAYS_PER_YEAR, 0.0);
return $this->getFormattedHoliday(is_numeric($holidays) ? $holidays : 0.0);
} }
public function setWorkHoursMonday(int $seconds): void public function setWorkHoursMonday(int $seconds): void
@@ -1332,14 +1335,28 @@ class User implements UserInterface, EquatableInterface, ThemeUserInterface, Pas
$this->setPreferenceValue(UserPreference::PUBLIC_HOLIDAY_GROUP, $group); $this->setPreferenceValue(UserPreference::PUBLIC_HOLIDAY_GROUP, $group);
} }
public function setHolidaysPerYear(?int $holidays): void public function setHolidaysPerYear(?float $holidays): void
{ {
$this->setPreferenceValue(UserPreference::HOLIDAYS_PER_YEAR, $holidays ?? 0); if ($holidays !== null) {
// makes sure that the number is a multiple of 0.5
$holidays = $this->getFormattedHoliday($holidays);
}
$this->setPreferenceValue(UserPreference::HOLIDAYS_PER_YEAR, $holidays ?? 0.0);
}
private function getFormattedHoliday(int|float|string|null $holidays): float
{
if (!is_numeric($holidays)) {
$holidays = 0.0;
}
return (float) number_format((round($holidays * 2) / 2), 1);
} }
public function hasContractSettings(): bool public function hasContractSettings(): bool
{ {
return $this->hasWorkHourConfiguration() || $this->getHolidaysPerYear() !== 0; return $this->hasWorkHourConfiguration() || $this->getHolidaysPerYear() !== 0.0;
} }
public function hasWorkHourConfiguration(): bool public function hasWorkHourConfiguration(): bool

View File

@@ -72,7 +72,7 @@
{% for column in project.data.data %} {% for column in project.data.data %}
{% set dateKey = column.date|report_date %} {% set dateKey = column.date|report_date %}
<td class="text-nowrap text-center day-total {% block column_classes_project %}{% endblock %}"> <td class="text-nowrap text-center day-total {% block column_classes_project %}{% endblock %}">
{% if column.duration > 0 or column.rate > 0 or column.internalRate > 0 %} {% if column.duration != 0 or column.rate != 0 or column.internalRate != 0 %}
{% if dataType == 'rate' %} {% if dataType == 'rate' %}
{% set totalsRate = totalsRate|merge({(dateKey): (totalsRate[dateKey] + column.rate)}) %} {% set totalsRate = totalsRate|merge({(dateKey): (totalsRate[dateKey] + column.rate)}) %}
<strong>{{ column.rate|money(currency) }}</strong> <strong>{{ column.rate|money(currency) }}</strong>
@@ -103,7 +103,7 @@
</td> </td>
{% for column in activity.data.data %} {% for column in activity.data.data %}
<td class="text-nowrap text-center day-total {% block column_classes_activity %}{% endblock %}"> <td class="text-nowrap text-center day-total {% block column_classes_activity %}{% endblock %}">
{% if column.duration > 0 or column.rate > 0 or column.internalRate > 0 %} {% if column.duration != 0 or column.rate != 0 or column.internalRate != 0 %}
{% if dataType == 'rate' %} {% if dataType == 'rate' %}
{{ column.rate|money(currency) }} {{ column.rate|money(currency) }}
{% elseif dataType == 'internalRate' %} {% elseif dataType == 'internalRate' %}

View File

@@ -20,12 +20,12 @@ use App\Tests\DataFixtures\TimesheetFixtures;
*/ */
class ActionsControllerTest extends APIControllerBaseTest class ActionsControllerTest extends APIControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/api/actions/timesheet/1/index/en'); $this->assertUrlIsSecured('/api/actions/timesheet/1/index/en');
} }
public function test_getTimesheetActions() public function test_getTimesheetActions(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -71,7 +71,7 @@ class ActionsControllerTest extends APIControllerBaseTest
} }
} }
public function test_getActivityActions() public function test_getActivityActions(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -121,7 +121,7 @@ class ActionsControllerTest extends APIControllerBaseTest
} }
} }
public function test_getProjectActions() public function test_getProjectActions(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -170,7 +170,7 @@ class ActionsControllerTest extends APIControllerBaseTest
} }
} }
public function test_getCustomerActions() public function test_getCustomerActions(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);

View File

@@ -86,7 +86,7 @@ class ActivityControllerTest extends APIControllerBaseTest
return [$rate1, $rate2]; return [$rate1, $rate2];
} }
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/api/activities'); $this->assertUrlIsSecured('/api/activities');
} }
@@ -201,7 +201,7 @@ class ActivityControllerTest extends APIControllerBaseTest
yield ['/api/activities', 1, ['projects' => ['2'], 'visible' => VisibilityInterface::SHOW_HIDDEN], [[true, 2], [false]]]; yield ['/api/activities', 1, ['projects' => ['2'], 'visible' => VisibilityInterface::SHOW_HIDDEN], [[true, 2], [false]]];
} }
public function testGetCollectionWithQuery() public function testGetCollectionWithQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$imports = $this->loadActivityTestData(); $imports = $this->loadActivityTestData();
@@ -219,7 +219,7 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertEquals($imports[1]->getId(), $result[2]['project']); $this->assertEquals($imports[1]->getId(), $result[2]['project']);
} }
public function testGetEntity() public function testGetEntity(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/activities/1'); $this->assertAccessIsGranted($client, '/api/activities/1');
@@ -229,12 +229,12 @@ class ActivityControllerTest extends APIControllerBaseTest
self::assertApiResponseTypeStructure('ActivityEntity', $result); self::assertApiResponseTypeStructure('ActivityEntity', $result);
} }
public function testNotFound() public function testNotFound(): void
{ {
$this->assertEntityNotFound(User::ROLE_USER, '/api/activities/' . PHP_INT_MAX, 'GET', 'App\\Entity\\Activity object not found by the @ParamConverter annotation.'); $this->assertEntityNotFound(User::ROLE_USER, '/api/activities/' . PHP_INT_MAX, 'GET', 'App\\Entity\\Activity object not found by the @ParamConverter annotation.');
} }
public function testPostAction() public function testPostAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -253,7 +253,7 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertNotEmpty($result['id']); $this->assertNotEmpty($result['id']);
} }
public function testPostActionWithLeastFields() public function testPostActionWithLeastFields(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -268,7 +268,7 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertNotEmpty($result['id']); $this->assertNotEmpty($result['id']);
} }
public function testPostActionWithInvalidUser() public function testPostActionWithInvalidUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$data = [ $data = [
@@ -281,7 +281,7 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertApiResponseAccessDenied($response, 'User cannot create activities'); $this->assertApiResponseAccessDenied($response, 'User cannot create activities');
} }
public function testPostActionWithInvalidData() public function testPostActionWithInvalidData(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -295,7 +295,7 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertApiCallValidationError($response, ['project'], true); $this->assertApiCallValidationError($response, ['project'], true);
} }
public function testPatchAction() public function testPatchAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -314,7 +314,7 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertNotEmpty($result['id']); $this->assertNotEmpty($result['id']);
} }
public function testPatchActionWithNonGlobalActivity() public function testPatchActionWithNonGlobalActivity(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$imports = $this->loadActivityTestData(); $imports = $this->loadActivityTestData();
@@ -337,7 +337,7 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertEquals($imports[1]->getId(), $result['project']); $this->assertEquals($imports[1]->getId(), $result['project']);
} }
public function testPatchActionWithInvalidUser() public function testPatchActionWithInvalidUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -352,12 +352,12 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertApiResponseAccessDenied($response, 'User cannot update activity'); $this->assertApiResponseAccessDenied($response, 'User cannot update activity');
} }
public function testPatchActionWithUnknownActivity() public function testPatchActionWithUnknownActivity(): void
{ {
$this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/activities/255', []); $this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/activities/255', []);
} }
public function testInvalidPatchAction() public function testInvalidPatchAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -371,12 +371,12 @@ class ActivityControllerTest extends APIControllerBaseTest
$this->assertApiCallValidationError($response, ['name']); $this->assertApiCallValidationError($response, ['name']);
} }
public function testMetaActionThrowsNotFound() public function testMetaActionThrowsNotFound(): void
{ {
$this->assertEntityNotFoundForPatch(User::ROLE_ADMIN, '/api/activities/42/meta', []); $this->assertEntityNotFoundForPatch(User::ROLE_ADMIN, '/api/activities/42/meta', []);
} }
public function testMetaActionThrowsExceptionOnMissingName() public function testMetaActionThrowsExceptionOnMissingName(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/activities/1/meta', ['value' => 'X'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/activities/1/meta', ['value' => 'X'], [
'code' => 400, 'code' => 400,
@@ -384,7 +384,7 @@ class ActivityControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaActionThrowsExceptionOnMissingValue() public function testMetaActionThrowsExceptionOnMissingValue(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/activities/1/meta', ['name' => 'X'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/activities/1/meta', ['name' => 'X'], [
'code' => 400, 'code' => 400,
@@ -392,7 +392,7 @@ class ActivityControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaActionThrowsExceptionOnMissingMetafield() public function testMetaActionThrowsExceptionOnMissingMetafield(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/activities/1/meta', ['name' => 'X', 'value' => 'Y'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/activities/1/meta', ['name' => 'X', 'value' => 'Y'], [
'code' => 404, 'code' => 404,
@@ -400,7 +400,7 @@ class ActivityControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaAction() public function testMetaAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
static::getContainer()->get('event_dispatcher')->addSubscriber(new ActivityTestMetaFieldSubscriberMock()); static::getContainer()->get('event_dispatcher')->addSubscriber(new ActivityTestMetaFieldSubscriberMock());

View File

@@ -41,7 +41,7 @@ class SessionAuthenticatorTest extends TestCase
return new SessionAuthenticator($token); return new SessionAuthenticator($token);
} }
public function testSupports() public function testSupports(): void
{ {
$sut = $this->getSut(); $sut = $this->getSut();
@@ -65,7 +65,7 @@ class SessionAuthenticatorTest extends TestCase
self::assertFalse($sut->supports($request)); self::assertFalse($sut->supports($request));
} }
public function testAuthenticateWithMissingAuthHeader() public function testAuthenticateWithMissingAuthHeader(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER'); $this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
@@ -76,7 +76,7 @@ class SessionAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithMissingToken() public function testAuthenticateWithMissingToken(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN'); $this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
@@ -87,7 +87,7 @@ class SessionAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithEmptyToken() public function testAuthenticateWithEmptyToken(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN'); $this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
@@ -98,7 +98,7 @@ class SessionAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithMissingUser() public function testAuthenticateWithMissingUser(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER'); $this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
@@ -109,7 +109,7 @@ class SessionAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithEmptyUser() public function testAuthenticateWithEmptyUser(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER'); $this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
@@ -120,7 +120,7 @@ class SessionAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticate() public function testAuthenticate(): void
{ {
$sut = $this->getSut(); $sut = $this->getSut();
@@ -141,7 +141,7 @@ class SessionAuthenticatorTest extends TestCase
self::assertTrue($badge->isResolved()); self::assertTrue($badge->isResolved());
} }
public function testAuthenticateFailsOnMissingApiTokenForUser() public function testAuthenticateFailsOnMissingApiTokenForUser(): void
{ {
$this->expectException(BadCredentialsException::class); $this->expectException(BadCredentialsException::class);
$this->expectExceptionMessage('The user has no activated API account.'); $this->expectExceptionMessage('The user has no activated API account.');
@@ -158,7 +158,7 @@ class SessionAuthenticatorTest extends TestCase
$badge->executeCustomChecker($user); $badge->executeCustomChecker($user);
} }
public function testAuthenticateFailsOnWrongPassword() public function testAuthenticateFailsOnWrongPassword(): void
{ {
$this->expectException(BadCredentialsException::class); $this->expectException(BadCredentialsException::class);
$this->expectExceptionMessage('The presented password is invalid.'); $this->expectExceptionMessage('The presented password is invalid.');

View File

@@ -38,7 +38,7 @@ class TokenAuthenticatorTest extends TestCase
return new TokenAuthenticator($userProvider, $passwordHasherFactory); return new TokenAuthenticator($userProvider, $passwordHasherFactory);
} }
public function testSupports() public function testSupports(): void
{ {
$sut = $this->getSut(); $sut = $this->getSut();
@@ -62,7 +62,7 @@ class TokenAuthenticatorTest extends TestCase
self::assertTrue($sut->supports($request)); self::assertTrue($sut->supports($request));
} }
public function testAuthenticateWithMissingAuthHeader() public function testAuthenticateWithMissingAuthHeader(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER'); $this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
@@ -73,7 +73,7 @@ class TokenAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithMissingToken() public function testAuthenticateWithMissingToken(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN'); $this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
@@ -84,7 +84,7 @@ class TokenAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithEmptyToken() public function testAuthenticateWithEmptyToken(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN'); $this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
@@ -95,7 +95,7 @@ class TokenAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithMissingUser() public function testAuthenticateWithMissingUser(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER'); $this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
@@ -106,7 +106,7 @@ class TokenAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticateWithEmptyUser() public function testAuthenticateWithEmptyUser(): void
{ {
$this->expectException(CustomUserMessageAuthenticationException::class); $this->expectException(CustomUserMessageAuthenticationException::class);
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER'); $this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
@@ -117,7 +117,7 @@ class TokenAuthenticatorTest extends TestCase
$sut->authenticate($request); $sut->authenticate($request);
} }
public function testAuthenticate() public function testAuthenticate(): void
{ {
$sut = $this->getSut(); $sut = $this->getSut();
@@ -138,7 +138,7 @@ class TokenAuthenticatorTest extends TestCase
self::assertTrue($badge->isResolved()); self::assertTrue($badge->isResolved());
} }
public function testAuthenticateFailsOnMissingApiTokenForUser() public function testAuthenticateFailsOnMissingApiTokenForUser(): void
{ {
$this->expectException(BadCredentialsException::class); $this->expectException(BadCredentialsException::class);
$this->expectExceptionMessage('The user has no activated API account.'); $this->expectExceptionMessage('The user has no activated API account.');
@@ -155,7 +155,7 @@ class TokenAuthenticatorTest extends TestCase
$badge->executeCustomChecker($user); $badge->executeCustomChecker($user);
} }
public function testAuthenticateFailsOnWrongPassword() public function testAuthenticateFailsOnWrongPassword(): void
{ {
$this->expectException(BadCredentialsException::class); $this->expectException(BadCredentialsException::class);
$this->expectExceptionMessage('The presented password is invalid.'); $this->expectExceptionMessage('The presented password is invalid.');

View File

@@ -16,12 +16,12 @@ use App\Entity\User;
*/ */
class ConfigurationControllerTest extends APIControllerBaseTest class ConfigurationControllerTest extends APIControllerBaseTest
{ {
public function testIsTimesheetSecure() public function testIsTimesheetSecure(): void
{ {
$this->assertUrlIsSecured('/api/config/timesheet'); $this->assertUrlIsSecured('/api/config/timesheet');
} }
public function testGetTimesheet() public function testGetTimesheet(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/config/timesheet', 'GET'); $this->assertAccessIsGranted($client, '/api/config/timesheet', 'GET');

View File

@@ -87,12 +87,12 @@ class CustomerControllerTest extends APIControllerBaseTest
return [$rate1, $rate2]; return [$rate1, $rate2];
} }
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/api/customers'); $this->assertUrlIsSecured('/api/customers');
} }
public function testGetCollection() public function testGetCollection(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/customers'); $this->assertAccessIsGranted($client, '/api/customers');
@@ -104,7 +104,7 @@ class CustomerControllerTest extends APIControllerBaseTest
self::assertApiResponseTypeStructure('CustomerCollection', $result[0]); self::assertApiResponseTypeStructure('CustomerCollection', $result[0]);
} }
public function testGetCollectionWithQuery() public function testGetCollectionWithQuery(): void
{ {
$query = ['order' => 'ASC', 'orderBy' => 'name', 'visible' => 3, 'term' => 'test']; $query = ['order' => 'ASC', 'orderBy' => 'name', 'visible' => 3, 'term' => 'test'];
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -117,7 +117,7 @@ class CustomerControllerTest extends APIControllerBaseTest
self::assertApiResponseTypeStructure('CustomerCollection', $result[0]); self::assertApiResponseTypeStructure('CustomerCollection', $result[0]);
} }
public function testGetEntity() public function testGetEntity(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/customers/1'); $this->assertAccessIsGranted($client, '/api/customers/1');
@@ -127,7 +127,7 @@ class CustomerControllerTest extends APIControllerBaseTest
self::assertApiResponseTypeStructure('CustomerEntity', $result); self::assertApiResponseTypeStructure('CustomerEntity', $result);
} }
public function testGetEntityWithFullResponse() public function testGetEntityWithFullResponse(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -171,12 +171,12 @@ class CustomerControllerTest extends APIControllerBaseTest
self::assertApiResponseTypeStructure('CustomerEntity', $result); self::assertApiResponseTypeStructure('CustomerEntity', $result);
} }
public function testNotFound() public function testNotFound(): void
{ {
$this->assertEntityNotFound(User::ROLE_USER, '/api/customers/' . PHP_INT_MAX, 'GET', 'App\\Entity\\Customer object not found by the @ParamConverter annotation.'); $this->assertEntityNotFound(User::ROLE_USER, '/api/customers/' . PHP_INT_MAX, 'GET', 'App\\Entity\\Customer object not found by the @ParamConverter annotation.');
} }
public function testPostAction() public function testPostAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -197,7 +197,7 @@ class CustomerControllerTest extends APIControllerBaseTest
$this->assertNotEmpty($result['id']); $this->assertNotEmpty($result['id']);
} }
public function testPostActionWithLeastFields() public function testPostActionWithLeastFields(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -215,7 +215,7 @@ class CustomerControllerTest extends APIControllerBaseTest
$this->assertNotEmpty($result['id']); $this->assertNotEmpty($result['id']);
} }
public function testPostActionWithInvalidUser() public function testPostActionWithInvalidUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$data = [ $data = [
@@ -230,7 +230,7 @@ class CustomerControllerTest extends APIControllerBaseTest
$this->assertApiResponseAccessDenied($response, 'User cannot create customers'); $this->assertApiResponseAccessDenied($response, 'User cannot create customers');
} }
public function testPostActionWithInvalidData() public function testPostActionWithInvalidData(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -246,7 +246,7 @@ class CustomerControllerTest extends APIControllerBaseTest
$this->assertApiCallValidationError($response, ['country', 'currency', 'timezone'], true); $this->assertApiCallValidationError($response, ['country', 'currency', 'timezone'], true);
} }
public function testPatchAction() public function testPatchAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -268,7 +268,7 @@ class CustomerControllerTest extends APIControllerBaseTest
$this->assertNotEmpty($result['id']); $this->assertNotEmpty($result['id']);
} }
public function testPatchActionWithInvalidUser() public function testPatchActionWithInvalidUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -285,12 +285,12 @@ class CustomerControllerTest extends APIControllerBaseTest
$this->assertApiResponseAccessDenied($response, 'User cannot update customer'); $this->assertApiResponseAccessDenied($response, 'User cannot update customer');
} }
public function testPatchActionWithUnknownActivity() public function testPatchActionWithUnknownActivity(): void
{ {
$this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/customers/255', []); $this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/customers/255', []);
} }
public function testInvalidPatchAction() public function testInvalidPatchAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -307,19 +307,19 @@ class CustomerControllerTest extends APIControllerBaseTest
$this->assertApiCallValidationError($response, ['currency']); $this->assertApiCallValidationError($response, ['currency']);
} }
public function testMetaActionNotAllowed() public function testMetaActionNotAllowed(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->request($client, '/api/customers/1/meta', 'PATCH', [], json_encode(['name' => 'asdasd'])); $this->request($client, '/api/customers/1/meta', 'PATCH', [], json_encode(['name' => 'asdasd']));
$this->assertApiResponseAccessDenied($client->getResponse(), 'You are not allowed to update this customer'); $this->assertApiResponseAccessDenied($client->getResponse(), 'You are not allowed to update this customer');
} }
public function testMetaActionThrowsNotFound() public function testMetaActionThrowsNotFound(): void
{ {
$this->assertEntityNotFoundForPatch(User::ROLE_ADMIN, '/api/customers/42/meta', []); $this->assertEntityNotFoundForPatch(User::ROLE_ADMIN, '/api/customers/42/meta', []);
} }
public function testMetaActionThrowsExceptionOnMissingName() public function testMetaActionThrowsExceptionOnMissingName(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/customers/1/meta', ['value' => 'X'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/customers/1/meta', ['value' => 'X'], [
'code' => 400, 'code' => 400,
@@ -327,7 +327,7 @@ class CustomerControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaActionThrowsExceptionOnMissingValue() public function testMetaActionThrowsExceptionOnMissingValue(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/customers/1/meta', ['name' => 'X'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/customers/1/meta', ['name' => 'X'], [
'code' => 400, 'code' => 400,
@@ -335,7 +335,7 @@ class CustomerControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaActionThrowsExceptionOnMissingMetafield() public function testMetaActionThrowsExceptionOnMissingMetafield(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/customers/1/meta', ['name' => 'X', 'value' => 'Y'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/customers/1/meta', ['name' => 'X', 'value' => 'Y'], [
'code' => 404, 'code' => 404,
@@ -343,7 +343,7 @@ class CustomerControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaAction() public function testMetaAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
self::getContainer()->get('event_dispatcher')->addSubscriber(new CustomerTestMetaFieldSubscriberMock()); self::getContainer()->get('event_dispatcher')->addSubscriber(new CustomerTestMetaFieldSubscriberMock());

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class TimesheetConfigTest extends TestCase class TimesheetConfigTest extends TestCase
{ {
public function testSetter() public function testSetter(): void
{ {
$sut = new TimesheetConfig(); $sut = new TimesheetConfig();
$sut->setIsAllowFutureTimes(false); $sut->setIsAllowFutureTimes(false);

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class NotFoundExceptionTest extends TestCase class NotFoundExceptionTest extends TestCase
{ {
public function testConstructor() public function testConstructor(): void
{ {
$sut = new NotFoundException(); $sut = new NotFoundException();
self::assertEquals('Not found', $sut->getMessage()); self::assertEquals('Not found', $sut->getMessage());

View File

@@ -88,12 +88,12 @@ class ProjectControllerTest extends APIControllerBaseTest
return [$rate1, $rate2]; return [$rate1, $rate2];
} }
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/api/projects'); $this->assertUrlIsSecured('/api/projects');
} }
public function testGetCollection() public function testGetCollection(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/api/projects'); $this->assertAccessIsGranted($client, '/api/projects');
@@ -242,7 +242,7 @@ class ProjectControllerTest extends APIControllerBaseTest
yield ['/api/projects', 1, ['customers' => ['2', '2'], 'visible' => VisibilityInterface::SHOW_HIDDEN, 'start' => '2010-12-11', 'end' => '2030-12-11'], []]; yield ['/api/projects', 1, ['customers' => ['2', '2'], 'visible' => VisibilityInterface::SHOW_HIDDEN, 'start' => '2010-12-11', 'end' => '2030-12-11'], []];
} }
public function testGetEntity() public function testGetEntity(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$em = $this->getEntityManager(); $em = $this->getEntityManager();
@@ -297,12 +297,12 @@ class ProjectControllerTest extends APIControllerBaseTest
} }
} }
public function testNotFound() public function testNotFound(): void
{ {
$this->assertEntityNotFound(User::ROLE_USER, '/api/projects/' . PHP_INT_MAX, 'GET', 'App\\Entity\\Project object not found by the @ParamConverter annotation.'); $this->assertEntityNotFound(User::ROLE_USER, '/api/projects/' . PHP_INT_MAX, 'GET', 'App\\Entity\\Project object not found by the @ParamConverter annotation.');
} }
public function testPostAction() public function testPostAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -331,7 +331,7 @@ class ProjectControllerTest extends APIControllerBaseTest
self::assertFalse($result['visible']); self::assertFalse($result['visible']);
} }
public function testPostActionWithOtherFields() public function testPostActionWithOtherFields(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -354,7 +354,7 @@ class ProjectControllerTest extends APIControllerBaseTest
self::assertTrue($result['visible']); self::assertTrue($result['visible']);
} }
public function testPostActionWithOtherFieldsAndFalse() public function testPostActionWithOtherFieldsAndFalse(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -377,7 +377,7 @@ class ProjectControllerTest extends APIControllerBaseTest
self::assertFalse($result['visible']); self::assertFalse($result['visible']);
} }
public function testPostActionWithOtherFields3() public function testPostActionWithOtherFields3(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -400,7 +400,7 @@ class ProjectControllerTest extends APIControllerBaseTest
self::assertTrue($result['visible']); self::assertTrue($result['visible']);
} }
public function testPostActionWithLeastFields() public function testPostActionWithLeastFields(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -420,7 +420,7 @@ class ProjectControllerTest extends APIControllerBaseTest
self::assertFalse($result['visible']); self::assertFalse($result['visible']);
} }
public function testPostActionWithInvalidUser() public function testPostActionWithInvalidUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$data = [ $data = [
@@ -433,7 +433,7 @@ class ProjectControllerTest extends APIControllerBaseTest
$this->assertApiResponseAccessDenied($response, 'User cannot create projects'); $this->assertApiResponseAccessDenied($response, 'User cannot create projects');
} }
public function testPostActionWithInvalidData() public function testPostActionWithInvalidData(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -447,7 +447,7 @@ class ProjectControllerTest extends APIControllerBaseTest
$this->assertApiCallValidationError($response, ['customer'], true); $this->assertApiCallValidationError($response, ['customer'], true);
} }
public function testPatchAction() public function testPatchAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -467,7 +467,7 @@ class ProjectControllerTest extends APIControllerBaseTest
$this->assertNotEmpty($result['id']); $this->assertNotEmpty($result['id']);
} }
public function testPatchActionWithInvalidUser() public function testPatchActionWithInvalidUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -482,12 +482,12 @@ class ProjectControllerTest extends APIControllerBaseTest
$this->assertApiResponseAccessDenied($response, 'User cannot update project'); $this->assertApiResponseAccessDenied($response, 'User cannot update project');
} }
public function testPatchActionWithUnknownActivity() public function testPatchActionWithUnknownActivity(): void
{ {
$this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/projects/255', []); $this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/projects/255', []);
} }
public function testInvalidPatchAction() public function testInvalidPatchAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -502,12 +502,12 @@ class ProjectControllerTest extends APIControllerBaseTest
$this->assertApiCallValidationError($response, ['customer']); $this->assertApiCallValidationError($response, ['customer']);
} }
public function testMetaActionThrowsNotFound() public function testMetaActionThrowsNotFound(): void
{ {
$this->assertEntityNotFoundForPatch(User::ROLE_ADMIN, '/api/projects/42/meta', []); $this->assertEntityNotFoundForPatch(User::ROLE_ADMIN, '/api/projects/42/meta', []);
} }
public function testMetaActionThrowsExceptionOnMissingName() public function testMetaActionThrowsExceptionOnMissingName(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/projects/1/meta', ['value' => 'X'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/projects/1/meta', ['value' => 'X'], [
'code' => 400, 'code' => 400,
@@ -515,7 +515,7 @@ class ProjectControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaActionThrowsExceptionOnMissingValue() public function testMetaActionThrowsExceptionOnMissingValue(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/projects/1/meta', ['name' => 'X'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/projects/1/meta', ['name' => 'X'], [
'code' => 400, 'code' => 400,
@@ -523,7 +523,7 @@ class ProjectControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaActionThrowsExceptionOnMissingMetafield() public function testMetaActionThrowsExceptionOnMissingMetafield(): void
{ {
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/projects/1/meta', ['name' => 'X', 'value' => 'Y'], [ $this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/projects/1/meta', ['name' => 'X', 'value' => 'Y'], [
'code' => 404, 'code' => 404,
@@ -531,7 +531,7 @@ class ProjectControllerTest extends APIControllerBaseTest
]); ]);
} }
public function testMetaAction() public function testMetaAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
self::getContainer()->get('event_dispatcher')->addSubscriber(new ProjectTestMetaFieldSubscriberMock()); self::getContainer()->get('event_dispatcher')->addSubscriber(new ProjectTestMetaFieldSubscriberMock());

View File

@@ -35,7 +35,7 @@ trait RateControllerTestTrait
*/ */
abstract protected function importTestRates($id): array; abstract protected function importTestRates($id): array;
public function testAddRateMissingEntityAction() public function testAddRateMissingEntityAction(): void
{ {
$data = [ $data = [
'user' => 1, 'user' => 1,
@@ -47,7 +47,7 @@ trait RateControllerTestTrait
$this->assertEntityNotFoundForPost($client, $this->getRateUrl(99), $data); $this->assertEntityNotFoundForPost($client, $this->getRateUrl(99), $data);
} }
public function testAddRateMissingUserAction() public function testAddRateMissingUserAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -63,7 +63,7 @@ trait RateControllerTestTrait
$this->assertApiCallValidationError($response, ['user']); $this->assertApiCallValidationError($response, ['user']);
} }
public function testAddRateActionWithInvalidUser() public function testAddRateActionWithInvalidUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$data = [ $data = [
@@ -77,7 +77,7 @@ trait RateControllerTestTrait
$this->assertApiResponseAccessDenied($response, 'Access denied.'); $this->assertApiResponseAccessDenied($response, 'Access denied.');
} }
public function testAddRateAction() public function testAddRateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -98,7 +98,7 @@ trait RateControllerTestTrait
$this->assertFalse($result['isFixed']); $this->assertFalse($result['isFixed']);
} }
public function testAddFixedRateAction() public function testAddFixedRateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$data = [ $data = [
@@ -119,7 +119,7 @@ trait RateControllerTestTrait
$this->assertTrue($result['isFixed']); $this->assertTrue($result['isFixed']);
} }
public function testGetRatesEmptyResult() public function testGetRatesEmptyResult(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->request($client, $this->getRateUrl(1)); $this->request($client, $this->getRateUrl(1));
@@ -130,7 +130,7 @@ trait RateControllerTestTrait
$this->assertEmpty($result); $this->assertEmpty($result);
} }
public function testGetRates() public function testGetRates(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$expectedRates = $this->importTestRates(1); $expectedRates = $this->importTestRates(1);
@@ -148,17 +148,17 @@ trait RateControllerTestTrait
} }
} }
public function testGetRatesEntityNotFound() public function testGetRatesEntityNotFound(): void
{ {
$this->assertEntityNotFound(User::ROLE_ADMIN, $this->getRateUrl(99)); $this->assertEntityNotFound(User::ROLE_ADMIN, $this->getRateUrl(99));
} }
public function testGetRatesIsSecured() public function testGetRatesIsSecured(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, $this->getRateUrl(1)); $this->assertUrlIsSecuredForRole(User::ROLE_USER, $this->getRateUrl(1));
} }
public function testDeleteRate() public function testDeleteRate(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$expectedRates = $this->importTestRates(1); $expectedRates = $this->importTestRates(1);
@@ -176,19 +176,19 @@ trait RateControllerTestTrait
$this->assertEquals(\count($expectedRates) - 1, \count($result)); $this->assertEquals(\count($expectedRates) - 1, \count($result));
} }
public function testDeleteRateEntityNotFound() public function testDeleteRateEntityNotFound(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertNotFoundForDelete($client, $this->getRateUrl(99, 1)); $this->assertNotFoundForDelete($client, $this->getRateUrl(99, 1));
} }
public function testDeleteRateRateNotFound() public function testDeleteRateRateNotFound(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertNotFoundForDelete($client, $this->getRateUrl(1, 99)); $this->assertNotFoundForDelete($client, $this->getRateUrl(1, 99));
} }
public function testDeleteRateWithInvalidAssignment() public function testDeleteRateWithInvalidAssignment(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->importTestRates(1); $this->importTestRates(1);
@@ -197,7 +197,7 @@ trait RateControllerTestTrait
$this->assertNotFoundForDelete($client, $this->getRateUrl(2, 1)); $this->assertNotFoundForDelete($client, $this->getRateUrl(2, 1));
} }
public function testDeleteNotAllowed() public function testDeleteNotAllowed(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$rates = $this->importTestRates(1); $rates = $this->importTestRates(1);
@@ -209,7 +209,7 @@ trait RateControllerTestTrait
$this->assertApiResponseAccessDenied($client->getResponse(), 'Access denied.'); $this->assertApiResponseAccessDenied($client->getResponse(), 'Access denied.');
} }
protected function assertRateStructure(array $result, $user = null) public function assertRateStructure(array $result, $user = null): void
{ {
$expectedKeys = [ $expectedKeys = [
'id', 'rate', 'internalRate', 'isFixed', 'user' 'id', 'rate', 'internalRate', 'isFixed', 'user'

View File

@@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
*/ */
class ValidationFailedExceptionErrorHandlerTest extends TestCase class ValidationFailedExceptionErrorHandlerTest extends TestCase
{ {
public function testSubscribingMethods() public function testSubscribingMethods(): void
{ {
self::assertEquals([[ self::assertEquals([[
'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
@@ -44,7 +44,7 @@ class ValidationFailedExceptionErrorHandlerTest extends TestCase
]], ValidationFailedExceptionErrorHandler::getSubscribingMethods()); ]], ValidationFailedExceptionErrorHandler::getSubscribingMethods());
} }
public function testWithEmptyConstraintsList() public function testWithEmptyConstraintsList(): void
{ {
$security = $this->createMock(Security::class); $security = $this->createMock(Security::class);
$translator = $this->createMock(TranslatorInterface::class); $translator = $this->createMock(TranslatorInterface::class);
@@ -64,7 +64,7 @@ class ValidationFailedExceptionErrorHandlerTest extends TestCase
self::assertEquals($expected, $sut->serializeValidationExceptionToJson(new JsonSerializationVisitor(), $validations, [], new SerializationContext())); self::assertEquals($expected, $sut->serializeValidationExceptionToJson(new JsonSerializationVisitor(), $validations, [], new SerializationContext()));
} }
public function testWithUnsupportedException() public function testWithUnsupportedException(): void
{ {
$security = $this->createMock(Security::class); $security = $this->createMock(Security::class);
$translator = $this->createMock(TranslatorInterface::class); $translator = $this->createMock(TranslatorInterface::class);
@@ -81,7 +81,7 @@ class ValidationFailedExceptionErrorHandlerTest extends TestCase
self::assertEquals('foooo', $actual); self::assertEquals('foooo', $actual);
} }
public function testWithConstraintsList() public function testWithConstraintsList(): void
{ {
$security = $this->createMock(Security::class); $security = $this->createMock(Security::class);
$translator = $this->createMock(TranslatorInterface::class); $translator = $this->createMock(TranslatorInterface::class);
@@ -125,7 +125,7 @@ class ValidationFailedExceptionErrorHandlerTest extends TestCase
)); ));
} }
public function testWithConstraintsListAndWrongException() public function testWithConstraintsListAndWrongException(): void
{ {
$security = $this->createMock(Security::class); $security = $this->createMock(Security::class);
$translator = $this->createMock(TranslatorInterface::class); $translator = $this->createMock(TranslatorInterface::class);

View File

@@ -54,7 +54,7 @@ class ActivityServiceTest extends TestCase
return $service; return $service;
} }
public function testCannotSavePersistedProjectAsNew() public function testCannotSavePersistedProjectAsNew(): void
{ {
$project = $this->createMock(Activity::class); $project = $this->createMock(Activity::class);
$project->expects($this->once())->method('getId')->willReturn(1); $project->expects($this->once())->method('getId')->willReturn(1);
@@ -67,7 +67,7 @@ class ActivityServiceTest extends TestCase
$sut->saveNewActivity($project); $sut->saveNewActivity($project);
} }
public function testsaveNewActivityHasValidationError() public function testsaveNewActivityHasValidationError(): void
{ {
$constraints = new ConstraintViolationList(); $constraints = new ConstraintViolationList();
$constraints->add(new ConstraintViolation('toooo many tests', 'abc.def', [], '$root', 'begin', 4, null, null, null, '$cause')); $constraints->add(new ConstraintViolation('toooo many tests', 'abc.def', [], '$root', 'begin', 4, null, null, null, '$cause'));
@@ -83,7 +83,7 @@ class ActivityServiceTest extends TestCase
$sut->saveNewActivity(new Activity()); $sut->saveNewActivity(new Activity());
} }
public function testUpdateDispatchesEvents() public function testUpdateDispatchesEvents(): void
{ {
$project = $this->createMock(Activity::class); $project = $this->createMock(Activity::class);
$project->method('getId')->willReturn(1); $project->method('getId')->willReturn(1);
@@ -106,7 +106,7 @@ class ActivityServiceTest extends TestCase
$sut->updateActivity($project); $sut->updateActivity($project);
} }
public function testcreateNewActivityDispatchesEvents() public function testcreateNewActivityDispatchesEvents(): void
{ {
$dispatcher = $this->createMock(EventDispatcherInterface::class); $dispatcher = $this->createMock(EventDispatcherInterface::class);
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) { $dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
@@ -129,7 +129,7 @@ class ActivityServiceTest extends TestCase
self::assertSame($project, $activity->getProject()); self::assertSame($project, $activity->getProject());
} }
public function testsaveNewActivityDispatchesEvents() public function testsaveNewActivityDispatchesEvents(): void
{ {
$dispatcher = $this->createMock(EventDispatcherInterface::class); $dispatcher = $this->createMock(EventDispatcherInterface::class);
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) { $dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
@@ -150,7 +150,7 @@ class ActivityServiceTest extends TestCase
$sut->saveNewActivity($activity); $sut->saveNewActivity($activity);
} }
public function testcreateNewActivityWithoutCustomer() public function testcreateNewActivityWithoutCustomer(): void
{ {
$sut = $this->getSut(); $sut = $this->getSut();

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class GoogleSourceTest extends TestCase class GoogleSourceTest extends TestCase
{ {
public function testConstruct() public function testConstruct(): void
{ {
$sut = new GoogleSource('0815', 'askdjfhlaksjdhflaksjhdflkjasdlkfjh', '#fffccc'); $sut = new GoogleSource('0815', 'askdjfhlaksjdhflaksjhdflkjasdlkfjh', '#fffccc');

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class GoogleTest extends TestCase class GoogleTest extends TestCase
{ {
public function testConstruct() public function testConstruct(): void
{ {
$sources = [ $sources = [
new GoogleSource('foo', '', '#ccc'), new GoogleSource('foo', '', '#ccc'),

View File

@@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class RecentActivitiesSourceTest extends TestCase class RecentActivitiesSourceTest extends TestCase
{ {
public function testConstruct() public function testConstruct(): void
{ {
$entries = [new TimesheetEntry(new Timesheet(), '#cccccc')]; $entries = [new TimesheetEntry(new Timesheet(), '#cccccc')];

View File

@@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class TimesheetEntryTest extends TestCase class TimesheetEntryTest extends TestCase
{ {
public function testConstruct() public function testConstruct(): void
{ {
$project = new Project(); $project = new Project();
$activity = new Activity(); $activity = new Activity();
@@ -60,7 +60,7 @@ class TimesheetEntryTest extends TestCase
$this->assertEquals($expectedData, $sut->getData()); $this->assertEquals($expectedData, $sut->getData());
} }
public function testEmpty() public function testEmpty(): void
{ {
$timesheet = new Timesheet(); $timesheet = new Timesheet();
@@ -78,7 +78,7 @@ class TimesheetEntryTest extends TestCase
$this->assertEquals($expectedData, $sut->getData()); $this->assertEquals($expectedData, $sut->getData());
} }
public function testGetTitle() public function testGetTitle(): void
{ {
$project = new Project(); $project = new Project();
$project->setName('sdfsdf'); $project->setName('sdfsdf');

View File

@@ -32,7 +32,7 @@ class ReloadCommandTest extends KernelTestCase
)); ));
} }
public function testCommandName() public function testCommandName(): void
{ {
$command = $this->application->find('kimai:reload'); $command = $this->application->find('kimai:reload');
self::assertInstanceOf(ReloadCommand::class, $command); self::assertInstanceOf(ReloadCommand::class, $command);

View File

@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
*/ */
class ResetDevelopmentCommandTest extends KernelTestCase class ResetDevelopmentCommandTest extends KernelTestCase
{ {
public function testCommandName() public function testCommandName(): void
{ {
$kernel = self::bootKernel(); $kernel = self::bootKernel();
$application = new Application($kernel); $application = new Application($kernel);
@@ -30,7 +30,7 @@ class ResetDevelopmentCommandTest extends KernelTestCase
self::assertInstanceOf(ResetDevelopmentCommand::class, $command); self::assertInstanceOf(ResetDevelopmentCommand::class, $command);
} }
public function testCommandNameIsNotEnabledInProd() public function testCommandNameIsNotEnabledInProd(): void
{ {
$sut = new ResetDevelopmentCommand('prod'); $sut = new ResetDevelopmentCommand('prod');
self::assertFalse($sut->isEnabled()); self::assertFalse($sut->isEnabled());

View File

@@ -20,7 +20,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
*/ */
class ResetTestCommandTest extends KernelTestCase class ResetTestCommandTest extends KernelTestCase
{ {
public function testCommandName() public function testCommandName(): void
{ {
$kernel = self::bootKernel(); $kernel = self::bootKernel();
$application = new Application($kernel); $application = new Application($kernel);
@@ -31,7 +31,7 @@ class ResetTestCommandTest extends KernelTestCase
self::assertInstanceOf(ResetTestCommand::class, $command); self::assertInstanceOf(ResetTestCommand::class, $command);
} }
public function testCommandNameIsNotEnabledInProd() public function testCommandNameIsNotEnabledInProd(): void
{ {
$sut = new ResetTestCommand($this->createMock(EntityManagerInterface::class), 'prod'); $sut = new ResetTestCommand($this->createMock(EntityManagerInterface::class), 'prod');
self::assertFalse($sut->isEnabled()); self::assertFalse($sut->isEnabled());

View File

@@ -34,13 +34,13 @@ class TimesheetStopAllCommandTest extends KernelTestCase
$this->application->add(new TimesheetStopAllCommand($service)); $this->application->add(new TimesheetStopAllCommand($service));
} }
public function testCommandName() public function testCommandName(): void
{ {
$command = $this->application->find('kimai:timesheet:stop-all'); $command = $this->application->find('kimai:timesheet:stop-all');
self::assertInstanceOf(TimesheetStopAllCommand::class, $command); self::assertInstanceOf(TimesheetStopAllCommand::class, $command);
} }
public function testRun() public function testRun(): void
{ {
$command = $this->application->find('kimai:timesheet:stop-all'); $command = $this->application->find('kimai:timesheet:stop-all');
$commandTester = new CommandTester($command); $commandTester = new CommandTester($command);

View File

@@ -42,7 +42,7 @@ class LdapConfigurationTest extends TestCase
]; ];
} }
public function testDefault() public function testDefault(): void
{ {
$sut = $this->getSut([]); $sut = $this->getSut([]);
$this->assertFalse($sut->isActivated()); $this->assertFalse($sut->isActivated());
@@ -51,7 +51,7 @@ class LdapConfigurationTest extends TestCase
$this->assertEquals([], $sut->getConnectionParameters()); $this->assertEquals([], $sut->getConnectionParameters());
} }
public function testMapping() public function testMapping(): void
{ {
$sut = $this->getSut($this->getDefaultSettings()); $sut = $this->getSut($this->getDefaultSettings());
$this->assertTrue($sut->isActivated()); $this->assertTrue($sut->isActivated());

View File

@@ -17,13 +17,13 @@ use PHPUnit\Framework\TestCase;
*/ */
class MailConfigurationTest extends TestCase class MailConfigurationTest extends TestCase
{ {
public function testGetFromAddress() public function testGetFromAddress(): void
{ {
$sut = new MailConfiguration('foo-bar123@example.com'); $sut = new MailConfiguration('foo-bar123@example.com');
self::assertEquals('foo-bar123@example.com', $sut->getFromAddress()); self::assertEquals('foo-bar123@example.com', $sut->getFromAddress());
} }
public function testGetFromAddressWithEmptyAddressReturnsNull() public function testGetFromAddressWithEmptyAddressReturnsNull(): void
{ {
$sut = new MailConfiguration(''); $sut = new MailConfiguration('');
self::assertNull($sut->getFromAddress()); self::assertNull($sut->getFromAddress());

View File

@@ -50,7 +50,7 @@ class SamlConfigurationTest extends TestCase
]; ];
} }
public function testDefault() public function testDefault(): void
{ {
$sut = $this->getSut([]); $sut = $this->getSut([]);
$this->assertFalse($sut->isActivated()); $this->assertFalse($sut->isActivated());
@@ -62,7 +62,7 @@ class SamlConfigurationTest extends TestCase
$this->assertFalse($sut->isRolesResetOnLogin()); $this->assertFalse($sut->isRolesResetOnLogin());
} }
public function testDefaultSettings() public function testDefaultSettings(): void
{ {
$sut = $this->getSut($this->getDefaultSettings()); $sut = $this->getSut($this->getDefaultSettings());
$this->assertTrue($sut->isActivated()); $this->assertTrue($sut->isActivated());

View File

@@ -19,7 +19,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
*/ */
class ConsoleApplicationTest extends TestCase class ConsoleApplicationTest extends TestCase
{ {
public function testVersion() public function testVersion(): void
{ {
$kernel = $this->createMock(KernelInterface::class); $kernel = $this->createMock(KernelInterface::class);
$sut = new ConsoleApplication($kernel); $sut = new ConsoleApplication($kernel);

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class ConstantsTest extends TestCase class ConstantsTest extends TestCase
{ {
public function testBuild() public function testBuild(): void
{ {
$version = Constants::VERSION; $version = Constants::VERSION;
$versionParts = explode('.', $version); $versionParts = explode('.', $version);

View File

@@ -27,17 +27,17 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser;
*/ */
class ActivityControllerTest extends ControllerBaseTest class ActivityControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/admin/activity/'); $this->assertUrlIsSecured('/admin/activity/');
} }
public function testIsSecureForRole() public function testIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/activity/'); $this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/activity/');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->assertAccessIsGranted($client, '/admin/activity/'); $this->assertAccessIsGranted($client, '/admin/activity/');
@@ -49,7 +49,7 @@ class ActivityControllerTest extends ControllerBaseTest
]); ]);
} }
public function testIndexActionAsSuperAdmin() public function testIndexActionAsSuperAdmin(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/activity/'); $this->assertAccessIsGranted($client, '/admin/activity/');
@@ -61,7 +61,7 @@ class ActivityControllerTest extends ControllerBaseTest
]); ]);
} }
public function testIndexActionWithSearchTermQuery() public function testIndexActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -92,19 +92,19 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertDataTableRowCount($client, 'datatable_activity_admin', 5); $this->assertDataTableRowCount($client, 'datatable_activity_admin', 5);
} }
public function testExportIsSecureForRole() public function testExportIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/activity/export'); $this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/activity/export');
} }
public function testExportAction() public function testExportAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->assertAccessIsGranted($client, '/admin/activity/export'); $this->assertAccessIsGranted($client, '/admin/activity/export');
$this->assertExcelExportResponse($client, 'kimai-activities_'); $this->assertExcelExportResponse($client, 'kimai-activities_');
} }
public function testExportActionWithSearchTermQuery() public function testExportActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -134,7 +134,7 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertExcelExportResponse($client, 'kimai-activities_'); $this->assertExcelExportResponse($client, 'kimai-activities_');
} }
public function testDetailsAction() public function testDetailsAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
/** @var EntityManager $em */ /** @var EntityManager $em */
@@ -171,7 +171,7 @@ class ActivityControllerTest extends ControllerBaseTest
self::assertEquals(1, $node->count()); self::assertEquals(1, $node->count());
} }
public function testAddRateAction() public function testAddRateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/activity/1/rate'); $this->assertAccessIsGranted($client, '/admin/activity/1/rate');
@@ -190,7 +190,7 @@ class ActivityControllerTest extends ControllerBaseTest
self::assertStringContainsString('123.45', $node->text(null, true)); self::assertStringContainsString('123.45', $node->text(null, true));
} }
public function testCreateAction() public function testCreateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/activity/create'); $this->assertAccessIsGranted($client, '/admin/activity/create');
@@ -218,7 +218,7 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertEquals('An AcTiVitY Name', $editForm->get('activity_edit_form[name]')->getValue()); $this->assertEquals('An AcTiVitY Name', $editForm->get('activity_edit_form[name]')->getValue());
} }
public function testCreateActionShowsMetaFields() public function testCreateActionShowsMetaFields(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
self::getContainer()->get('event_dispatcher')->addSubscriber(new ActivityTestMetaFieldSubscriberMock()); self::getContainer()->get('event_dispatcher')->addSubscriber(new ActivityTestMetaFieldSubscriberMock());
@@ -231,7 +231,7 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertFalse($form->has('activity_edit_form[metaFields][0][value]')); $this->assertFalse($form->has('activity_edit_form[metaFields][0][value]'));
} }
public function testEditAction() public function testEditAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/activity/1/edit'); $this->assertAccessIsGranted($client, '/admin/activity/1/edit');
@@ -247,7 +247,7 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue()); $this->assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue());
} }
public function testEditActionForGlobalActivity() public function testEditActionForGlobalActivity(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/activity/1/edit'); $this->assertAccessIsGranted($client, '/admin/activity/1/edit');
@@ -263,7 +263,7 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue()); $this->assertEquals('Test 2', $editForm->get('activity_edit_form[name]')->getValue());
} }
public function testTeamPermissionAction() public function testTeamPermissionAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$em = $this->getEntityManager(); $em = $this->getEntityManager();
@@ -295,7 +295,7 @@ class ActivityControllerTest extends ControllerBaseTest
self::assertEquals(2, $activity->getTeams()->count()); self::assertEquals(2, $activity->getTeams()->count());
} }
public function testCreateDefaultTeamAction() public function testCreateDefaultTeamAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/activity/1/details'); $this->assertAccessIsGranted($client, '/admin/activity/1/details');
@@ -311,7 +311,7 @@ class ActivityControllerTest extends ControllerBaseTest
self::assertEquals(1, $node->count()); self::assertEquals(1, $node->count());
} }
public function testDeleteAction() public function testDeleteAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->request($client, '/admin/activity/1/edit'); $this->request($client, '/admin/activity/1/edit');
@@ -332,7 +332,7 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithTimesheetEntries() public function testDeleteActionWithTimesheetEntries(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -372,7 +372,7 @@ class ActivityControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithTimesheetEntriesAndReplacement() public function testDeleteActionWithTimesheetEntriesAndReplacement(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -428,7 +428,7 @@ class ActivityControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getValidationTestData * @dataProvider getValidationTestData
*/ */
public function testValidationForCreateAction(array $formData, array $validationFields) public function testValidationForCreateAction(array $formData, array $validationFields): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_ADMIN, User::ROLE_ADMIN,

View File

@@ -60,7 +60,7 @@ class SamlControllerTest extends TestCase
return new SamlConfiguration($this->getSystemConfigurationMock($this->getDefaultSettings($activated), [])); return new SamlConfiguration($this->getSystemConfigurationMock($this->getDefaultSettings($activated), []));
} }
public function testAssertionConsumerServiceAction() public function testAssertionConsumerServiceAction(): void
{ {
$this->expectException(\RuntimeException::class); $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('You must configure the check path in your firewall.'); $this->expectExceptionMessage('You must configure the check path in your firewall.');
@@ -71,7 +71,7 @@ class SamlControllerTest extends TestCase
$sut->assertionConsumerServiceAction(); $sut->assertionConsumerServiceAction();
} }
public function testMetadataAction() public function testMetadataAction(): void
{ {
$expectedXmlString = <<<EOD $expectedXmlString = <<<EOD
<?xml version="1.0"?> <?xml version="1.0"?>
@@ -120,7 +120,7 @@ class SamlControllerTest extends TestCase
self::assertEquals($expected->firstChild->firstChild, $actual->firstChild->firstChild); self::assertEquals($expected->firstChild->firstChild, $actual->firstChild->firstChild);
} }
public function testLoginActionThrowsErrorOnSecurityErrorAttribute() public function testLoginActionThrowsErrorOnSecurityErrorAttribute(): void
{ {
$this->expectException(\RuntimeException::class); $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('My test error'); $this->expectExceptionMessage('My test error');
@@ -135,7 +135,7 @@ class SamlControllerTest extends TestCase
$sut->loginAction($request); $sut->loginAction($request);
} }
public function testLoginActionThrowsExceptionOnDisabledSaml() public function testLoginActionThrowsExceptionOnDisabledSaml(): void
{ {
$this->expectException(NotFoundHttpException::class); $this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('SAML deactivated'); $this->expectExceptionMessage('SAML deactivated');
@@ -146,7 +146,7 @@ class SamlControllerTest extends TestCase
$sut->loginAction(new Request()); $sut->loginAction(new Request());
} }
public function testMetadataActionThrowsExceptionOnDisabledSaml() public function testMetadataActionThrowsExceptionOnDisabledSaml(): void
{ {
$this->expectException(NotFoundHttpException::class); $this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('SAML deactivated'); $this->expectExceptionMessage('SAML deactivated');
@@ -157,7 +157,7 @@ class SamlControllerTest extends TestCase
$sut->metadataAction(); $sut->metadataAction();
} }
public function testLogoutActionThrowsExceptionOnDisabledSaml() public function testLogoutActionThrowsExceptionOnDisabledSaml(): void
{ {
$this->expectException(NotFoundHttpException::class); $this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('SAML deactivated'); $this->expectExceptionMessage('SAML deactivated');
@@ -168,7 +168,7 @@ class SamlControllerTest extends TestCase
$sut->logoutAction(); $sut->logoutAction();
} }
public function testAcsActionThrowsExceptionOnDisabledSaml() public function testAcsActionThrowsExceptionOnDisabledSaml(): void
{ {
$this->expectException(NotFoundHttpException::class); $this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('SAML deactivated'); $this->expectExceptionMessage('SAML deactivated');

View File

@@ -20,12 +20,12 @@ use App\Tests\Mocks\SystemConfigurationFactory;
*/ */
class CalendarControllerTest extends ControllerBaseTest class CalendarControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/calendar/'); $this->assertUrlIsSecured('/calendar/');
} }
public function testCalendarAction() public function testCalendarAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(); $client = $this->getClientForAuthenticatedUser();
$fixtures = new TimesheetFixtures($this->getUserByRole(), 10); $fixtures = new TimesheetFixtures($this->getUserByRole(), 10);
@@ -42,13 +42,13 @@ class CalendarControllerTest extends ControllerBaseTest
$this->assertEquals(1, $dragAndDropBoxes->count()); $this->assertEquals(1, $dragAndDropBoxes->count());
} }
public function testCalendarActionAsSuperAdmin() public function testCalendarActionAsSuperAdmin(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/calendar/'); $this->assertAccessIsGranted($client, '/calendar/');
} }
public function testCalendarActionWithGoogleSource() public function testCalendarActionWithGoogleSource(): void
{ {
$loader = new TestConfigLoader([]); $loader = new TestConfigLoader([]);
$config = SystemConfigurationFactory::create($loader, $this->getDefaultSettings()); $config = SystemConfigurationFactory::create($loader, $this->getDefaultSettings());

View File

@@ -28,17 +28,17 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser;
*/ */
class CustomerControllerTest extends ControllerBaseTest class CustomerControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/admin/customer/'); $this->assertUrlIsSecured('/admin/customer/');
} }
public function testIsSecureForRole() public function testIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/customer/'); $this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/customer/');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->assertAccessIsGranted($client, '/admin/customer/'); $this->assertAccessIsGranted($client, '/admin/customer/');
@@ -49,7 +49,7 @@ class CustomerControllerTest extends ControllerBaseTest
]); ]);
} }
public function testIndexActionAsSuperAdmin() public function testIndexActionAsSuperAdmin(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/'); $this->assertAccessIsGranted($client, '/admin/customer/');
@@ -61,7 +61,7 @@ class CustomerControllerTest extends ControllerBaseTest
]); ]);
} }
public function testIndexActionWithSearchTermQuery() public function testIndexActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -95,19 +95,19 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertDataTableRowCount($client, 'datatable_customer_admin', 5); $this->assertDataTableRowCount($client, 'datatable_customer_admin', 5);
} }
public function testExportIsSecureForRole() public function testExportIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/customer/export'); $this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/customer/export');
} }
public function testExportAction() public function testExportAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->assertAccessIsGranted($client, '/admin/customer/export'); $this->assertAccessIsGranted($client, '/admin/customer/export');
$this->assertExcelExportResponse($client, 'kimai-customers_'); $this->assertExcelExportResponse($client, 'kimai-customers_');
} }
public function testExportActionWithSearchTermQuery() public function testExportActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
@@ -126,7 +126,7 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertExcelExportResponse($client, 'kimai-customers_'); $this->assertExcelExportResponse($client, 'kimai-customers_');
} }
public function testDetailsAction() public function testDetailsAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/details'); $this->assertAccessIsGranted($client, '/admin/customer/1/details');
@@ -155,7 +155,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertEquals(1, $node->count()); self::assertEquals(1, $node->count());
} }
public function testAddRateAction() public function testAddRateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/rate'); $this->assertAccessIsGranted($client, '/admin/customer/1/rate');
@@ -174,7 +174,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertStringContainsString('123.45', $node->text(null, true)); self::assertStringContainsString('123.45', $node->text(null, true));
} }
public function testAddCommentAction() public function testAddCommentAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -197,7 +197,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertStringContainsString('<p>A beautiful and short comment <strong>with some</strong> markdown formatting</p>', $node->html()); self::assertStringContainsString('<p>A beautiful and short comment <strong>with some</strong> markdown formatting</p>', $node->html());
} }
public function testDeleteCommentAction() public function testDeleteCommentAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/details'); $this->assertAccessIsGranted($client, '/admin/customer/1/details');
@@ -221,7 +221,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertStringContainsString('There were no comments posted yet', $node->html()); self::assertStringContainsString('There were no comments posted yet', $node->html());
} }
public function testDeleteCommentActionWithoutToken() public function testDeleteCommentActionWithoutToken(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/details'); $this->assertAccessIsGranted($client, '/admin/customer/1/details');
@@ -242,7 +242,7 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertRouteNotFound($client); $this->assertRouteNotFound($client);
} }
public function testPinCommentAction() public function testPinCommentAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/details'); $this->assertAccessIsGranted($client, '/admin/customer/1/details');
@@ -269,7 +269,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertStringContainsString('/comment_pin/', $node->attr('href')); self::assertStringContainsString('/comment_pin/', $node->attr('href'));
} }
public function testCreateDefaultTeamAction() public function testCreateDefaultTeamAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/details'); $this->assertAccessIsGranted($client, '/admin/customer/1/details');
@@ -285,7 +285,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertEquals(1, $node->count()); self::assertEquals(1, $node->count());
} }
public function testProjectsAction() public function testProjectsAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/projects/1'); $this->assertAccessIsGranted($client, '/admin/customer/1/projects/1');
@@ -310,7 +310,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertEquals(5, $node->count()); self::assertEquals(5, $node->count());
} }
public function testCreateAction() public function testCreateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/create'); $this->assertAccessIsGranted($client, '/admin/customer/create');
@@ -332,7 +332,7 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertHasFlashSuccess($client); $this->assertHasFlashSuccess($client);
} }
public function testCreateActionShowsMetaFields() public function testCreateActionShowsMetaFields(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
self::getContainer()->get('event_dispatcher')->addSubscriber(new CustomerTestMetaFieldSubscriberMock()); self::getContainer()->get('event_dispatcher')->addSubscriber(new CustomerTestMetaFieldSubscriberMock());
@@ -345,7 +345,7 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertFalse($form->has('customer_edit_form[metaFields][0][value]')); $this->assertFalse($form->has('customer_edit_form[metaFields][0][value]'));
} }
public function testEditAction() public function testEditAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/customer/1/edit'); $this->assertAccessIsGranted($client, '/admin/customer/1/edit');
@@ -363,7 +363,7 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertEquals('Test Customer 2', $editForm->get('customer_edit_form[name]')->getValue()); $this->assertEquals('Test Customer 2', $editForm->get('customer_edit_form[name]')->getValue());
} }
public function testTeamPermissionAction() public function testTeamPermissionAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$em = $this->getEntityManager(); $em = $this->getEntityManager();
@@ -394,7 +394,7 @@ class CustomerControllerTest extends ControllerBaseTest
self::assertEquals(2, $customer->getTeams()->count()); self::assertEquals(2, $customer->getTeams()->count());
} }
public function testDeleteAction() public function testDeleteAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -421,7 +421,7 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithTimesheetEntries() public function testDeleteActionWithTimesheetEntries(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -459,7 +459,7 @@ class CustomerControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithTimesheetEntriesAndReplacement() public function testDeleteActionWithTimesheetEntriesAndReplacement(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -513,7 +513,7 @@ class CustomerControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getValidationTestData * @dataProvider getValidationTestData
*/ */
public function testValidationForCreateAction(array $formData, array $validationFields) public function testValidationForCreateAction(array $formData, array $validationFields): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_ADMIN, User::ROLE_ADMIN,

View File

@@ -14,12 +14,12 @@ namespace App\Tests\Controller;
*/ */
class DashboardControllerTest extends ControllerBaseTest class DashboardControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/dashboard/'); $this->assertUrlIsSecured('/dashboard/');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(); $client = $this->getClientForAuthenticatedUser();
$this->request($client, '/dashboard/'); $this->request($client, '/dashboard/');

View File

@@ -16,17 +16,17 @@ use App\Entity\User;
*/ */
class DoctorControllerTest extends ControllerBaseTest class DoctorControllerTest extends ControllerBaseTest
{ {
public function testDoctorIsSecure() public function testDoctorIsSecure(): void
{ {
$this->assertUrlIsSecured('/doctor'); $this->assertUrlIsSecured('/doctor');
} }
public function testDoctorIsSecureForRole() public function testDoctorIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/doctor'); $this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/doctor');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/doctor'); $this->assertAccessIsGranted($client, '/doctor');
@@ -37,7 +37,7 @@ class DoctorControllerTest extends ControllerBaseTest
self::assertTrue($counter === 6 || $counter === 5); self::assertTrue($counter === 6 || $counter === 5);
} }
public function testFlushLogWithInvalidCsrf() public function testFlushLogWithInvalidCsrf(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);

View File

@@ -20,17 +20,17 @@ use Doctrine\ORM\EntityManager;
*/ */
class ExportControllerTest extends ControllerBaseTest class ExportControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/export/'); $this->assertUrlIsSecured('/export/');
} }
public function testIsSecureForrole() public function testIsSecureForrole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/export/'); $this->assertUrlIsSecuredForRole(User::ROLE_USER, '/export/');
} }
public function testIndexActionHasErrorMessageOnEmptyQuery() public function testIndexActionHasErrorMessageOnEmptyQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
@@ -40,7 +40,7 @@ class ExportControllerTest extends ControllerBaseTest
$this->assertHasNoEntriesWithFilter($client); $this->assertHasNoEntriesWithFilter($client);
} }
public function testIndexActionWithEntriesAndTeams() public function testIndexActionWithEntriesAndTeams(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$em = $this->getEntityManager(); $em = $this->getEntityManager();
@@ -109,7 +109,7 @@ class ExportControllerTest extends ControllerBaseTest
$this->assertEmpty($expected); $this->assertEmpty($expected);
} }
public function testIndexActionWithEntriesForTeamleadDoesNotShowUserWithoutTeam() public function testIndexActionWithEntriesForTeamleadDoesNotShowUserWithoutTeam(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
@@ -168,7 +168,7 @@ class ExportControllerTest extends ControllerBaseTest
$this->assertEmpty($expected); $this->assertEmpty($expected);
} }
public function testExportActionWithMissingRenderer() public function testExportActionWithMissingRenderer(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->request($client, '/export/data', 'POST'); $this->request($client, '/export/data', 'POST');
@@ -177,7 +177,7 @@ class ExportControllerTest extends ControllerBaseTest
$this->assert404($response, 'Missing export renderer'); $this->assert404($response, 'Missing export renderer');
} }
public function testExportActionWithInvalidRenderer() public function testExportActionWithInvalidRenderer(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
@@ -197,7 +197,7 @@ class ExportControllerTest extends ControllerBaseTest
$this->assert404($response, 'Unknown export renderer'); $this->assert404($response, 'Unknown export renderer');
} }
public function testExportAction() public function testExportAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
/** @var EntityManager $em */ /** @var EntityManager $em */

View File

@@ -18,19 +18,19 @@ use App\Form\Type\InitialViewType;
*/ */
class HomepageControllerTest extends ControllerBaseTest class HomepageControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/homepage'); $this->assertUrlIsSecured('/homepage');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->request($client, '/homepage'); $this->request($client, '/homepage');
$this->assertIsRedirect($client, '/en/timesheet/'); $this->assertIsRedirect($client, '/en/timesheet/');
} }
public function testIndexActionWithChangedPreferences() public function testIndexActionWithChangedPreferences(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);

View File

@@ -32,17 +32,17 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser;
*/ */
class ProjectControllerTest extends ControllerBaseTest class ProjectControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/admin/project/'); $this->assertUrlIsSecured('/admin/project/');
} }
public function testIsSecureForRole() public function testIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/project/'); $this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/project/');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->assertAccessIsGranted($client, '/admin/project/'); $this->assertAccessIsGranted($client, '/admin/project/');
@@ -53,7 +53,7 @@ class ProjectControllerTest extends ControllerBaseTest
]); ]);
} }
public function testIndexActionAsSuperAdmin() public function testIndexActionAsSuperAdmin(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/'); $this->assertAccessIsGranted($client, '/admin/project/');
@@ -65,7 +65,7 @@ class ProjectControllerTest extends ControllerBaseTest
]); ]);
} }
public function testIndexActionWithSearchTermQuery() public function testIndexActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -100,19 +100,19 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertDataTableRowCount($client, 'datatable_project_admin', 5); $this->assertDataTableRowCount($client, 'datatable_project_admin', 5);
} }
public function testExportIsSecureForRole() public function testExportIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/project/export'); $this->assertUrlIsSecuredForRole(User::ROLE_USER, '/admin/project/export');
} }
public function testExportAction() public function testExportAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->assertAccessIsGranted($client, '/admin/project/export'); $this->assertAccessIsGranted($client, '/admin/project/export');
$this->assertExcelExportResponse($client, 'kimai-projects_'); $this->assertExcelExportResponse($client, 'kimai-projects_');
} }
public function testExportActionWithSearchTermQuery() public function testExportActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -141,7 +141,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertExcelExportResponse($client, 'kimai-projects_'); $this->assertExcelExportResponse($client, 'kimai-projects_');
} }
public function testDetailsAction() public function testDetailsAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
/** @var EntityManager $em */ /** @var EntityManager $em */
@@ -187,13 +187,13 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertEquals(1, $node->count()); self::assertEquals(1, $node->count());
} }
public function testAddRateAction() public function testAddRateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAddRate($client, 123.45, 1); $this->assertAddRate($client, 123.45, 1);
} }
protected function assertAddRate(HttpKernelBrowser $client, $rate, $projectId) public function assertAddRate(HttpKernelBrowser $client, $rate, $projectId): void
{ {
$this->assertAccessIsGranted($client, '/admin/project/' . $projectId . '/rate'); $this->assertAccessIsGranted($client, '/admin/project/' . $projectId . '/rate');
$form = $client->getCrawler()->filter('form[name=project_rate_form]')->form(); $form = $client->getCrawler()->filter('form[name=project_rate_form]')->form();
@@ -211,7 +211,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertStringContainsString($rate, $node->text(null, true)); self::assertStringContainsString($rate, $node->text(null, true));
} }
public function testDuplicateAction() public function testDuplicateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
/** @var EntityManager $em */ /** @var EntityManager $em */
@@ -251,7 +251,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertStringContainsString('123.45', $node->text(null, true)); self::assertStringContainsString('123.45', $node->text(null, true));
} }
public function testDuplicateActionWithInvalidCsrf() public function testDuplicateActionWithInvalidCsrf(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
/** @var EntityManager $em */ /** @var EntityManager $em */
@@ -270,7 +270,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertInvalidCsrfToken($client, '/admin/project/1/duplicate/rsetdzfukgli78t6r5uedtjfzkugl', $this->createUrl('/admin/project/1/details')); $this->assertInvalidCsrfToken($client, '/admin/project/1/duplicate/rsetdzfukgli78t6r5uedtjfzkugl', $this->createUrl('/admin/project/1/details'));
} }
public function testAddCommentAction() public function testAddCommentAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/details'); $this->assertAccessIsGranted($client, '/admin/project/1/details');
@@ -291,7 +291,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertStringContainsString('<p>A beautiful and long comment <strong>with some</strong> markdown formatting</p>', $node->html()); self::assertStringContainsString('<p>A beautiful and long comment <strong>with some</strong> markdown formatting</p>', $node->html());
} }
public function testDeleteCommentAction() public function testDeleteCommentAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/details'); $this->assertAccessIsGranted($client, '/admin/project/1/details');
@@ -314,7 +314,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertStringContainsString('There were no comments posted yet', $node->html()); self::assertStringContainsString('There were no comments posted yet', $node->html());
} }
public function testPinCommentAction() public function testPinCommentAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/details'); $this->assertAccessIsGranted($client, '/admin/project/1/details');
@@ -342,7 +342,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertStringContainsString('/comment_pin/', $node->attr('href')); self::assertStringContainsString('/comment_pin/', $node->attr('href'));
} }
public function testCreateDefaultTeamAction() public function testCreateDefaultTeamAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/details'); $this->assertAccessIsGranted($client, '/admin/project/1/details');
@@ -358,7 +358,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertEquals(1, $node->count()); self::assertEquals(1, $node->count());
} }
public function testActivitiesAction() public function testActivitiesAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/activities/1'); $this->assertAccessIsGranted($client, '/admin/project/1/activities/1');
@@ -384,7 +384,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertEquals(5, $node->count()); self::assertEquals(5, $node->count());
} }
public function testCreateAction() public function testCreateAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/create'); $this->assertAccessIsGranted($client, '/admin/project/create');
@@ -403,7 +403,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertHasFlashSuccess($client); $this->assertHasFlashSuccess($client);
} }
public function testCreateActionShowsMetaFields() public function testCreateActionShowsMetaFields(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
self::getContainer()->get('event_dispatcher')->addSubscriber(new ProjectTestMetaFieldSubscriberMock()); self::getContainer()->get('event_dispatcher')->addSubscriber(new ProjectTestMetaFieldSubscriberMock());
@@ -416,7 +416,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertFalse($form->has('project_edit_form[metaFields][0][value]')); $this->assertFalse($form->has('project_edit_form[metaFields][0][value]'));
} }
public function testEditAction() public function testEditAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->assertAccessIsGranted($client, '/admin/project/1/edit'); $this->assertAccessIsGranted($client, '/admin/project/1/edit');
@@ -432,7 +432,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertEquals('Test 2', $editForm->get('project_edit_form[name]')->getValue()); $this->assertEquals('Test 2', $editForm->get('project_edit_form[name]')->getValue());
} }
public function testTeamPermissionAction() public function testTeamPermissionAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$em = $this->getEntityManager(); $em = $this->getEntityManager();
@@ -463,7 +463,7 @@ class ProjectControllerTest extends ControllerBaseTest
self::assertEquals(2, $project->getTeams()->count()); self::assertEquals(2, $project->getTeams()->count());
} }
public function testDeleteAction() public function testDeleteAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -490,7 +490,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithTimesheetEntries() public function testDeleteActionWithTimesheetEntries(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -528,7 +528,7 @@ class ProjectControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithTimesheetEntriesAndReplacement() public function testDeleteActionWithTimesheetEntriesAndReplacement(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
@@ -581,7 +581,7 @@ class ProjectControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getValidationTestData * @dataProvider getValidationTestData
*/ */
public function testValidationForCreateAction(array $formData, array $validationFields) public function testValidationForCreateAction(array $formData, array $validationFields): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_ADMIN, User::ROLE_ADMIN,

View File

@@ -16,12 +16,12 @@ use App\Tests\DataFixtures\TimesheetFixtures;
*/ */
class QuickEntryControllerTest extends ControllerBaseTest class QuickEntryControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/quick_entry'); $this->assertUrlIsSecured('/quick_entry');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(); $client = $this->getClientForAuthenticatedUser();
$this->request($client, '/quick_entry'); $this->request($client, '/quick_entry');
@@ -52,7 +52,7 @@ class QuickEntryControllerTest extends ControllerBaseTest
self::assertCount(10, $columns); self::assertCount(10, $columns);
} }
public function testIndexActionWith() public function testIndexActionWith(): void
{ {
$client = $this->getClientForAuthenticatedUser(); $client = $this->getClientForAuthenticatedUser();

View File

@@ -32,7 +32,7 @@ abstract class AbstractUserPeriodControllerTest extends ControllerBaseTest
abstract protected function getBoxId(): string; abstract protected function getBoxId(): string;
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured($this->getReportUrl()); $this->assertUrlIsSecured($this->getReportUrl());
} }
@@ -49,7 +49,7 @@ abstract class AbstractUserPeriodControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getTestData * @dataProvider getTestData
*/ */
public function testUserPeriodReport(int $user, string $dataType, string $title) public function testUserPeriodReport(int $user, string $dataType, string $title): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->importReportingFixture(User::ROLE_SUPER_ADMIN); $this->importReportingFixture(User::ROLE_SUPER_ADMIN);
@@ -61,7 +61,7 @@ abstract class AbstractUserPeriodControllerTest extends ControllerBaseTest
self::assertEquals($title, $cell->text()); self::assertEquals($title, $cell->text());
} }
public function testUserPeriodReportAsTeamlead() public function testUserPeriodReportAsTeamlead(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->importReportingFixture(User::ROLE_USER); $this->importReportingFixture(User::ROLE_USER);

View File

@@ -35,7 +35,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest
abstract protected function getBoxId(): string; abstract protected function getBoxId(): string;
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured($this->getReportUrl()); $this->assertUrlIsSecured($this->getReportUrl());
} }
@@ -52,7 +52,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getTestData * @dataProvider getTestData
*/ */
public function testUsersPeriodReport(string $dataType, string $title) public function testUsersPeriodReport(string $dataType, string $title): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->importReportingFixture(User::ROLE_SUPER_ADMIN); $this->importReportingFixture(User::ROLE_SUPER_ADMIN);
@@ -65,7 +65,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getTestData * @dataProvider getTestData
*/ */
public function testUsersPeriodReportAsTeamlead(string $dataType, string $title) public function testUsersPeriodReportAsTeamlead(string $dataType, string $title): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD);
$this->importReportingFixture(User::ROLE_TEAMLEAD); $this->importReportingFixture(User::ROLE_TEAMLEAD);
@@ -80,7 +80,7 @@ abstract class AbstractUsersPeriodControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getTestData * @dataProvider getTestData
*/ */
public function testUsersPeriodReportExport(string $dataType, string $title) public function testUsersPeriodReportExport(string $dataType, string $title): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->importReportingFixture(User::ROLE_SUPER_ADMIN); $this->importReportingFixture(User::ROLE_SUPER_ADMIN);

View File

@@ -24,12 +24,12 @@ use Symfony\Component\HttpKernel\HttpKernelBrowser;
*/ */
class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest
{ {
public function testReportIsSecure() public function testReportIsSecure(): void
{ {
$this->assertUrlIsSecured('/reporting/customer/monthly_projects/view'); $this->assertUrlIsSecured('/reporting/customer/monthly_projects/view');
} }
public function testExportReportIsSecure() public function testExportReportIsSecure(): void
{ {
$this->assertUrlIsSecured('/reporting/customer/monthly_projects/export'); $this->assertUrlIsSecured('/reporting/customer/monthly_projects/export');
} }
@@ -73,7 +73,7 @@ class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest
return $client; return $client;
} }
public function testReport() public function testReport(): void
{ {
$client = $this->prepareReport(); $client = $this->prepareReport();
@@ -83,7 +83,7 @@ class CustomerMonthlyProjectsControllerTest extends ControllerBaseTest
self::assertGreaterThan(0, $rows->count()); self::assertGreaterThan(0, $rows->count());
} }
public function testExport() public function testExport(): void
{ {
$client = $this->prepareReport(); $client = $this->prepareReport();

View File

@@ -23,12 +23,12 @@ use App\Timesheet\DateTimeFactory;
*/ */
class ProjectDateRangeControllerTest extends ControllerBaseTest class ProjectDateRangeControllerTest extends ControllerBaseTest
{ {
public function testReportIsSecure() public function testReportIsSecure(): void
{ {
$this->assertUrlIsSecured('/reporting/project_daterange'); $this->assertUrlIsSecured('/reporting/project_daterange');
} }
public function testReport() public function testReport(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);

View File

@@ -21,12 +21,12 @@ use App\Tests\DataFixtures\TimesheetFixtures;
*/ */
class ProjectDetailsControllerTest extends ControllerBaseTest class ProjectDetailsControllerTest extends ControllerBaseTest
{ {
public function testReportIsSecure() public function testReportIsSecure(): void
{ {
$this->assertUrlIsSecured('/reporting/project_details'); $this->assertUrlIsSecured('/reporting/project_details');
} }
public function testReport() public function testReport(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);

View File

@@ -21,12 +21,12 @@ use App\Tests\DataFixtures\TimesheetFixtures;
*/ */
class ProjectInactiveControllerTest extends ControllerBaseTest class ProjectInactiveControllerTest extends ControllerBaseTest
{ {
public function testReportIsSecure() public function testReportIsSecure(): void
{ {
$this->assertUrlIsSecured('/reporting/project_inactive'); $this->assertUrlIsSecured('/reporting/project_inactive');
} }
public function testReport() public function testReport(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);

View File

@@ -21,12 +21,12 @@ use App\Tests\DataFixtures\TimesheetFixtures;
*/ */
class ProjectViewControllerTest extends ControllerBaseTest class ProjectViewControllerTest extends ControllerBaseTest
{ {
public function testReportIsSecure() public function testReportIsSecure(): void
{ {
$this->assertUrlIsSecured('/reporting/project_view'); $this->assertUrlIsSecured('/reporting/project_view');
} }
public function testReport() public function testReport(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);

View File

@@ -16,12 +16,12 @@ use App\Entity\User;
*/ */
class ReportingControllerTest extends ControllerBaseTest class ReportingControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/reporting'); $this->assertUrlIsSecured('/reporting');
} }
public function testOverviewPage() public function testOverviewPage(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
$this->request($client, '/reporting/'); $this->request($client, '/reporting/');
@@ -29,7 +29,7 @@ class ReportingControllerTest extends ControllerBaseTest
$this->assertCount(11, $nodes); $this->assertCount(11, $nodes);
} }
public function testOverviewPageAsUser() public function testOverviewPageAsUser(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->request($client, '/reporting/'); $this->request($client, '/reporting/');

View File

@@ -24,27 +24,27 @@ class PasswordResetControllerTest extends ControllerBaseTest
$this->assertRouteNotFound($client); $this->assertRouteNotFound($client);
} }
public function testResetRequestWithDeactivatedFeature() public function testResetRequestWithDeactivatedFeature(): void
{ {
$this->testResetActionWithDeactivatedFeature('/resetting/request'); $this->testResetActionWithDeactivatedFeature('/resetting/request');
} }
public function testSendEmailRequestWithDeactivatedFeature() public function testSendEmailRequestWithDeactivatedFeature(): void
{ {
$this->testResetActionWithDeactivatedFeature('/resetting/send-email', 'POST'); $this->testResetActionWithDeactivatedFeature('/resetting/send-email', 'POST');
} }
public function testCheckEmailWithDeactivatedFeature() public function testCheckEmailWithDeactivatedFeature(): void
{ {
$this->testResetActionWithDeactivatedFeature('/resetting/check-email'); $this->testResetActionWithDeactivatedFeature('/resetting/check-email');
} }
public function testResetWithDeactivatedFeature() public function testResetWithDeactivatedFeature(): void
{ {
$this->testResetActionWithDeactivatedFeature('/resetting/reset/1234567890'); $this->testResetActionWithDeactivatedFeature('/resetting/reset/1234567890');
} }
public function testResetRequestPageIsRendered() public function testResetRequestPageIsRendered(): void
{ {
$client = self::createClient(); $client = self::createClient();

View File

@@ -18,7 +18,7 @@ use Symfony\Bundle\FrameworkBundle\KernelBrowser;
*/ */
class SelfRegistrationControllerTest extends ControllerBaseTest class SelfRegistrationControllerTest extends ControllerBaseTest
{ {
private function testRegisterActionWithDeactivatedFeature(string $route) private function assertRegisterActionWithDeactivatedFeature(string $route): void
{ {
$client = self::createClient(); $client = self::createClient();
$this->setSystemConfiguration('user.registration', false); $this->setSystemConfiguration('user.registration', false);
@@ -26,27 +26,27 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
$this->assertRouteNotFound($client); $this->assertRouteNotFound($client);
} }
public function testRegisterWithDeactivatedFeature() public function testRegisterWithDeactivatedFeature(): void
{ {
$this->testRegisterActionWithDeactivatedFeature('/register/'); $this->assertRegisterActionWithDeactivatedFeature('/register/');
} }
public function testCheckEmailWithDeactivatedFeature() public function testCheckEmailWithDeactivatedFeature(): void
{ {
$this->testRegisterActionWithDeactivatedFeature('/register/check-email'); $this->assertRegisterActionWithDeactivatedFeature('/register/check-email');
} }
public function testConfirmWithDeactivatedFeature() public function testConfirmWithDeactivatedFeature(): void
{ {
$this->testRegisterActionWithDeactivatedFeature('/register/confirm/123123'); $this->assertRegisterActionWithDeactivatedFeature('/register/confirm/123123');
} }
public function testConfirmedWithDeactivatedFeature() public function testConfirmedWithDeactivatedFeature(): void
{ {
$this->testRegisterActionWithDeactivatedFeature('/register/confirmed'); $this->assertRegisterActionWithDeactivatedFeature('/register/confirmed');
} }
public function testRegisterAccountPageIsRendered() public function testRegisterAccountPageIsRendered(): void
{ {
$client = self::createClient(); $client = self::createClient();
$this->setSystemConfiguration('user.registration', true); $this->setSystemConfiguration('user.registration', true);
@@ -98,7 +98,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
return $this->loadUserFromDatabase($username); return $this->loadUserFromDatabase($username);
} }
public function testCheckEmailWithoutEmail() public function testCheckEmailWithoutEmail(): void
{ {
$client = self::createClient(); $client = self::createClient();
$this->setSystemConfiguration('user.registration', true); $this->setSystemConfiguration('user.registration', true);
@@ -109,7 +109,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
$this->assertTrue($client->getResponse()->isSuccessful()); $this->assertTrue($client->getResponse()->isSuccessful());
} }
public function testRegisterAccount() public function testRegisterAccount(): void
{ {
$client = self::createClient(); $client = self::createClient();
$this->createUser($client, 'example', 'register@example.com', 'test1234'); $this->createUser($client, 'example', 'register@example.com', 'test1234');
@@ -120,7 +120,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
$this->assertStringContainsString('<a href="/en/login">', $content); $this->assertStringContainsString('<a href="/en/login">', $content);
} }
public function testConfirmWithInvalidToken() public function testConfirmWithInvalidToken(): void
{ {
$client = self::createClient(); $client = self::createClient();
$this->setSystemConfiguration('user.registration', true); $this->setSystemConfiguration('user.registration', true);
@@ -131,7 +131,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
$this->assertTrue($client->getResponse()->isSuccessful()); $this->assertTrue($client->getResponse()->isSuccessful());
} }
public function testConfirmAccount() public function testConfirmAccount(): void
{ {
$client = self::createClient(); $client = self::createClient();
$user = $this->createUser($client, 'example', 'register@example.com', 'test1234'); $user = $this->createUser($client, 'example', 'register@example.com', 'test1234');
@@ -151,7 +151,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
self::assertTrue($user->isEnabled()); self::assertTrue($user->isEnabled());
} }
public function testConfirmedAnonymousRedirectsToLogin() public function testConfirmedAnonymousRedirectsToLogin(): void
{ {
$client = self::createClient(); $client = self::createClient();
$this->setSystemConfiguration('user.registration', true); $this->setSystemConfiguration('user.registration', true);
@@ -166,7 +166,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getValidationTestData * @dataProvider getValidationTestData
*/ */
public function testRegisterActionWithValidationProblems(array $formData, array $validationFields) public function testRegisterActionWithValidationProblems(array $formData, array $validationFields): void
{ {
$client = self::createClient(); $client = self::createClient();
$this->setSystemConfiguration('user.registration', true); $this->setSystemConfiguration('user.registration', true);
@@ -174,7 +174,7 @@ class SelfRegistrationControllerTest extends ControllerBaseTest
$this->assertHasValidationError($client, '/register/', 'form[name=user_registration_form]', $formData, $validationFields); $this->assertHasValidationError($client, '/register/', 'form[name=user_registration_form]', $formData, $validationFields);
} }
public function getValidationTestData() public function getValidationTestData(): array // @phpstan-ignore-line
{ {
return [ return [
[ [

View File

@@ -17,12 +17,12 @@ use App\Entity\User;
*/ */
class SystemConfigurationControllerTest extends ControllerBaseTest class SystemConfigurationControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/admin/system-config/'); $this->assertUrlIsSecured('/admin/system-config/');
} }
public function testIsSecureForRole() public function testIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/system-config/'); $this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/system-config/');
} }
@@ -32,7 +32,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
return static::getContainer()->get(SystemConfiguration::class); return static::getContainer()->get(SystemConfiguration::class);
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/'); $this->assertAccessIsGranted($client, '/admin/system-config/');
@@ -55,7 +55,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
} }
} }
public function testSectionAction() public function testSectionAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/edit/timesheet'); $this->assertAccessIsGranted($client, '/admin/system-config/edit/timesheet');
@@ -91,7 +91,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
]; ];
} }
public function testUpdateTimesheetConfig() public function testUpdateTimesheetConfig(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/'); $this->assertAccessIsGranted($client, '/admin/system-config/');
@@ -129,7 +129,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertEquals(99, $configService->find('timesheet.active_entries.hard_limit')); $this->assertEquals(99, $configService->find('timesheet.active_entries.hard_limit'));
} }
public function testUpdateLockdownPeriodConfig() public function testUpdateLockdownPeriodConfig(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/'); $this->assertAccessIsGranted($client, '/admin/system-config/');
@@ -164,7 +164,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertEquals('+ 12 hours', $configService->find('timesheet.rules.lockdown_grace_period')); $this->assertEquals('+ 12 hours', $configService->find('timesheet.rules.lockdown_grace_period'));
} }
public function testUpdateTimesheetConfigValidation() public function testUpdateTimesheetConfigValidation(): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_SUPER_ADMIN, User::ROLE_SUPER_ADMIN,
@@ -190,7 +190,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
); );
} }
public function testUpdateCustomerConfig() public function testUpdateCustomerConfig(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/'); $this->assertAccessIsGranted($client, '/admin/system-config/');
@@ -222,7 +222,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertEquals('GBP', $configService->find('defaults.customer.currency')); $this->assertEquals('GBP', $configService->find('defaults.customer.currency'));
} }
public function testUpdateCustomerConfigWithSingleParam() public function testUpdateCustomerConfigWithSingleParam(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/edit/customer'); $this->assertAccessIsGranted($client, '/admin/system-config/edit/customer');
@@ -245,7 +245,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertHasFlashSaveSuccess($client); $this->assertHasFlashSaveSuccess($client);
} }
public function testUpdateUserConfig() public function testUpdateUserConfig(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/edit/user'); $this->assertAccessIsGranted($client, '/admin/system-config/edit/user');
@@ -277,7 +277,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertEquals('ru', $configService->find('defaults.user.language')); $this->assertEquals('ru', $configService->find('defaults.user.language'));
} }
public function testUpdateCustomerConfigValidation() public function testUpdateCustomerConfigValidation(): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_SUPER_ADMIN, User::ROLE_SUPER_ADMIN,
@@ -300,7 +300,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
); );
} }
public function testUpdateThemeConfig() public function testUpdateThemeConfig(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/'); $this->assertAccessIsGranted($client, '/admin/system-config/');
@@ -326,7 +326,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertTrue($configService->find('timesheet.markdown_content')); $this->assertTrue($configService->find('timesheet.markdown_content'));
} }
public function testUpdateThemeConfigValidation() public function testUpdateThemeConfigValidation(): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_SUPER_ADMIN, User::ROLE_SUPER_ADMIN,
@@ -346,7 +346,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
); );
} }
public function testUpdateCalendarConfig() public function testUpdateCalendarConfig(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/'); $this->assertAccessIsGranted($client, '/admin/system-config/');
@@ -387,7 +387,7 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertEquals('21:43', $configService->find('calendar.visibleHours.end')); $this->assertEquals('21:43', $configService->find('calendar.visibleHours.end'));
} }
public function testUpdateCalendarConfigValidation() public function testUpdateCalendarConfigValidation(): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_SUPER_ADMIN, User::ROLE_SUPER_ADMIN,

View File

@@ -18,17 +18,17 @@ use App\Tests\DataFixtures\TimesheetFixtures;
*/ */
class UserControllerTest extends ControllerBaseTest class UserControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/admin/user/'); $this->assertUrlIsSecured('/admin/user/');
} }
public function testIsSecureForRole() public function testIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/user/'); $this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/user/');
} }
public function testIndexAction() public function testIndexAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/user/'); $this->assertAccessIsGranted($client, '/admin/user/');
@@ -43,7 +43,7 @@ class UserControllerTest extends ControllerBaseTest
]); ]);
} }
public function testIndexActionWithSearchTermQuery() public function testIndexActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -64,19 +64,19 @@ class UserControllerTest extends ControllerBaseTest
$this->assertDataTableRowCount($client, 'datatable_user_admin', 1); $this->assertDataTableRowCount($client, 'datatable_user_admin', 1);
} }
public function testExportIsSecureForRole() public function testExportIsSecureForRole(): void
{ {
$this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/user/export'); $this->assertUrlIsSecuredForRole(User::ROLE_ADMIN, '/admin/user/export');
} }
public function testExportAction() public function testExportAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/user/export'); $this->assertAccessIsGranted($client, '/admin/user/export');
$this->assertExcelExportResponse($client, 'kimai-users_'); $this->assertExcelExportResponse($client, 'kimai-users_');
} }
public function testExportActionWithSearchTermQuery() public function testExportActionWithSearchTermQuery(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -96,7 +96,7 @@ class UserControllerTest extends ControllerBaseTest
$this->assertExcelExportResponse($client, 'kimai-users_'); $this->assertExcelExportResponse($client, 'kimai-users_');
} }
public function testCreateAction() public function testCreateAction(): void
{ {
$username = '亚历山德拉' . uniqid(); $username = '亚历山德拉' . uniqid();
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -119,7 +119,7 @@ class UserControllerTest extends ControllerBaseTest
$this->assertEquals($username, $form->get('user_edit[alias]')->getValue()); $this->assertEquals($username, $form->get('user_edit[alias]')->getValue());
} }
public function testDeleteAction() public function testDeleteAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -138,7 +138,7 @@ class UserControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithTimesheetEntries() public function testDeleteActionWithTimesheetEntries(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -172,7 +172,7 @@ class UserControllerTest extends ControllerBaseTest
$this->assertFalse($client->getResponse()->isSuccessful()); $this->assertFalse($client->getResponse()->isSuccessful());
} }
public function testDeleteActionWithUserReplacementAndTimesheetEntries() public function testDeleteActionWithUserReplacementAndTimesheetEntries(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN); $client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
@@ -222,7 +222,7 @@ class UserControllerTest extends ControllerBaseTest
/** /**
* @dataProvider getValidationTestData * @dataProvider getValidationTestData
*/ */
public function testValidationForCreateAction(array $formData, array $validationFields) public function testValidationForCreateAction(array $formData, array $validationFields): void
{ {
$this->assertFormHasValidationError( $this->assertFormHasValidationError(
User::ROLE_SUPER_ADMIN, User::ROLE_SUPER_ADMIN,

View File

@@ -16,12 +16,12 @@ use App\Entity\User;
*/ */
class WidgetControllerTest extends ControllerBaseTest class WidgetControllerTest extends ControllerBaseTest
{ {
public function testIsSecure() public function testIsSecure(): void
{ {
$this->assertUrlIsSecured('/widgets/working-time/2020/1'); $this->assertUrlIsSecured('/widgets/working-time/2020/1');
} }
public function testWorkingtimechartAction() public function testWorkingtimechartAction(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/widgets/working-time/2020/1'); $this->assertAccessIsGranted($client, '/widgets/working-time/2020/1');

View File

@@ -16,7 +16,7 @@ use App\Entity\User;
*/ */
class WizardControllerTest extends ControllerBaseTest class WizardControllerTest extends ControllerBaseTest
{ {
public function testUnknownWizard() public function testUnknownWizard(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
@@ -24,21 +24,21 @@ class WizardControllerTest extends ControllerBaseTest
$this->assertRouteNotFound($client); $this->assertRouteNotFound($client);
} }
public function testIntroWizard() public function testIntroWizard(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/wizard/intro'); $this->assertAccessIsGranted($client, '/wizard/intro');
} }
public function testProfileWizard() public function testProfileWizard(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
$this->assertAccessIsGranted($client, '/wizard/profile'); $this->assertAccessIsGranted($client, '/wizard/profile');
} }
public function testDoneWizard() public function testDoneWizard(): void
{ {
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $client = $this->getClientForAuthenticatedUser(User::ROLE_USER);

View File

@@ -69,7 +69,7 @@ class CustomerServiceTest extends TestCase
return new CustomerService($repository, $configuration, $validator, $dispatcher); return new CustomerService($repository, $configuration, $validator, $dispatcher);
} }
public function testCannotSavePersistedCustomerAsNew() public function testCannotSavePersistedCustomerAsNew(): void
{ {
$Customer = $this->createMock(Customer::class); $Customer = $this->createMock(Customer::class);
$Customer->expects($this->once())->method('getId')->willReturn(1); $Customer->expects($this->once())->method('getId')->willReturn(1);
@@ -82,7 +82,7 @@ class CustomerServiceTest extends TestCase
$sut->saveNewCustomer($Customer); $sut->saveNewCustomer($Customer);
} }
public function testSaveNewCustomerHasValidationError() public function testSaveNewCustomerHasValidationError(): void
{ {
$constraints = new ConstraintViolationList(); $constraints = new ConstraintViolationList();
$constraints->add(new ConstraintViolation('toooo many tests', 'abc.def', [], '$root', 'begin', 4, null, null, null, '$cause')); $constraints->add(new ConstraintViolation('toooo many tests', 'abc.def', [], '$root', 'begin', 4, null, null, null, '$cause'));
@@ -98,7 +98,7 @@ class CustomerServiceTest extends TestCase
$sut->saveNewCustomer(new Customer('foo')); $sut->saveNewCustomer(new Customer('foo'));
} }
public function testUpdateDispatchesEvents() public function testUpdateDispatchesEvents(): void
{ {
$Customer = $this->createMock(Customer::class); $Customer = $this->createMock(Customer::class);
$Customer->method('getId')->willReturn(1); $Customer->method('getId')->willReturn(1);
@@ -121,7 +121,7 @@ class CustomerServiceTest extends TestCase
$sut->updateCustomer($Customer); $sut->updateCustomer($Customer);
} }
public function testCreateNewCustomerDispatchesEvents() public function testCreateNewCustomerDispatchesEvents(): void
{ {
$dispatcher = $this->createMock(EventDispatcherInterface::class); $dispatcher = $this->createMock(EventDispatcherInterface::class);
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) { $dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {
@@ -146,7 +146,7 @@ class CustomerServiceTest extends TestCase
self::assertEquals('RUB', $customer->getCurrency()); self::assertEquals('RUB', $customer->getCurrency());
} }
public function testSaveNewCustomerDispatchesEvents() public function testSaveNewCustomerDispatchesEvents(): void
{ {
$dispatcher = $this->createMock(EventDispatcherInterface::class); $dispatcher = $this->createMock(EventDispatcherInterface::class);
$dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) { $dispatcher->expects($this->exactly(2))->method('dispatch')->willReturnCallback(function ($event) {

View File

@@ -26,7 +26,7 @@ class ConfigurationTest extends TestCase
]; ];
} }
protected function assertConfig($inputConfig, $expectedConfig) public function assertConfig($inputConfig, $expectedConfig): void
{ {
$finalizedConfig = $this->getCompiledConfig($inputConfig); $finalizedConfig = $this->getCompiledConfig($inputConfig);
@@ -43,7 +43,7 @@ class ConfigurationTest extends TestCase
return $node->finalize($normalizedConfig); return $node->finalize($normalizedConfig);
} }
public function testValidateDataDir() public function testValidateDataDir(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.data_dir": Data directory does not exist'); $this->expectExceptionMessage('Invalid configuration for path "kimai.data_dir": Data directory does not exist');
@@ -51,7 +51,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($this->getMinConfig('sdfsdfsdfds'), []); $this->assertConfig($this->getMinConfig('sdfsdfsdfds'), []);
} }
public function testValidateLdapConfigUserBaseDn() public function testValidateLdapConfigUserBaseDn(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap": The "ldap.user.baseDn" config must be set if LDAP is activated.'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap": The "ldap.user.baseDn" config must be set if LDAP is activated.');
@@ -67,7 +67,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateLdapConfig() public function testValidateLdapConfig(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection": The ldap.connection.useSsl and ldap.connection.useStartTls options are mutually exclusive.'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection": The ldap.connection.useSsl and ldap.connection.useStartTls options are mutually exclusive.');
@@ -83,7 +83,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateLdapFilterIncludingReplacer() public function testValidateLdapFilterIncludingReplacer(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.user.filter": The ldap.user.filter must be enclosed by a matching number of parentheses "()" and must NOT contain a "%s" replacer'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.user.filter": The ldap.user.filter must be enclosed by a matching number of parentheses "()" and must NOT contain a "%s" replacer');
@@ -98,7 +98,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateLdapFilterMissingStartingParenthesis() public function testValidateLdapFilterMissingStartingParenthesis(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.user.filter": The ldap.user.filter must be enclosed by a matching number of parentheses "()" and must NOT contain a "%s" replacer'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.user.filter": The ldap.user.filter must be enclosed by a matching number of parentheses "()" and must NOT contain a "%s" replacer');
@@ -113,7 +113,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateCalendarDragDropMaxEntries() public function testValidateCalendarDragDropMaxEntries(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.calendar.dragdrop_amount": The dragdrop_amount must be between 0 and 20'); $this->expectExceptionMessage('Invalid configuration for path "kimai.calendar.dragdrop_amount": The dragdrop_amount must be between 0 and 20');
@@ -126,7 +126,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateLdapFilterInvalidParenthesisCounter() public function testValidateLdapFilterInvalidParenthesisCounter(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.user.filter": The ldap.user.filter must be enclosed by a matching number of parentheses "()" and must NOT contain a "%s" replacer'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.user.filter": The ldap.user.filter must be enclosed by a matching number of parentheses "()" and must NOT contain a "%s" replacer');
@@ -141,7 +141,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateLdapAccountFilterFormatMissingUserAttributeReplacer() public function testValidateLdapAccountFilterFormatMissingUserAttributeReplacer(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection.accountFilterFormat": The accountFilterFormat must be enclosed by a matching number of parentheses "()" and contain one "%s" replacer for the username'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection.accountFilterFormat": The accountFilterFormat must be enclosed by a matching number of parentheses "()" and contain one "%s" replacer for the username');
@@ -156,7 +156,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateLdapAccountFilterFormatMissingStartingParenthesis() public function testValidateLdapAccountFilterFormatMissingStartingParenthesis(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection.accountFilterFormat": The accountFilterFormat must be enclosed by a matching number of parentheses "()" and contain one "%s" replacer for the username'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection.accountFilterFormat": The accountFilterFormat must be enclosed by a matching number of parentheses "()" and contain one "%s" replacer for the username');
@@ -171,7 +171,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateLdapAccountFilterFormatInvalidParenthesisCounter() public function testValidateLdapAccountFilterFormatInvalidParenthesisCounter(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection.accountFilterFormat": The accountFilterFormat must be enclosed by a matching number of parentheses "()" and contain one "%s" replacer for the username'); $this->expectExceptionMessage('Invalid configuration for path "kimai.ldap.connection.accountFilterFormat": The accountFilterFormat must be enclosed by a matching number of parentheses "()" and contain one "%s" replacer for the username');
@@ -186,7 +186,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateSamlIsMissingMappingForEmail() public function testValidateSamlIsMissingMappingForEmail(): void
{ {
$this->expectException(InvalidConfigurationException::class); $this->expectException(InvalidConfigurationException::class);
$this->expectExceptionMessage('Invalid configuration for path "kimai.saml": You need to configure a SAML mapping for the email attribute.'); $this->expectExceptionMessage('Invalid configuration for path "kimai.saml": You need to configure a SAML mapping for the email attribute.');
@@ -200,7 +200,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, []); $this->assertConfig($config, []);
} }
public function testValidateSamlDoesNotTriggerOnDeactivatedSaml() public function testValidateSamlDoesNotTriggerOnDeactivatedSaml(): void
{ {
$finalizedConfig = $this->getCompiledConfig($this->getMinConfig()); $finalizedConfig = $this->getCompiledConfig($this->getMinConfig());
$config = $this->getMinConfig(); $config = $this->getMinConfig();
@@ -212,7 +212,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, $finalizedConfig); $this->assertConfig($config, $finalizedConfig);
} }
public function testValidateSamlDoesNotTriggerWhenEmailMappingExists() public function testValidateSamlDoesNotTriggerWhenEmailMappingExists(): void
{ {
$config = $this->getMinConfig(); $config = $this->getMinConfig();
$config['saml'] = [ $config['saml'] = [
@@ -226,7 +226,7 @@ class ConfigurationTest extends TestCase
$this->assertConfig($config, $finalizedConfig); $this->assertConfig($config, $finalizedConfig);
} }
public function testDefaultLdapSettings() public function testDefaultLdapSettings(): void
{ {
$finalizedConfig = $this->getCompiledConfig($this->getMinConfig()); $finalizedConfig = $this->getCompiledConfig($this->getMinConfig());
$expected = [ $expected = [
@@ -257,7 +257,7 @@ class ConfigurationTest extends TestCase
self::assertEquals($expected, $finalizedConfig['ldap']); self::assertEquals($expected, $finalizedConfig['ldap']);
} }
public function testFullDefaultConfig() public function testFullDefaultConfig(): void
{ {
$fullDefaultConfig = [ $fullDefaultConfig = [
'data_dir' => '/tmp/', 'data_dir' => '/tmp/',

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class TimesheetSubscriberTest extends TestCase class TimesheetSubscriberTest extends TestCase
{ {
public function testGetSubscribedEvents() public function testGetSubscribedEvents(): void
{ {
$sut = new TimesheetSubscriber([]); $sut = new TimesheetSubscriber([]);
$events = $sut->getSubscribedEvents(); $events = $sut->getSubscribedEvents();

View File

@@ -17,7 +17,7 @@ abstract class AbstractCommentEntityTest extends TestCase
{ {
abstract protected function getEntity(): CommentInterface; abstract protected function getEntity(): CommentInterface;
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = $this->getEntity(); $sut = $this->getEntity();
@@ -29,7 +29,7 @@ abstract class AbstractCommentEntityTest extends TestCase
self::assertFalse($sut->isPinned()); self::assertFalse($sut->isPinned());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = $this->getEntity(); $sut = $this->getEntity();

View File

@@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase;
abstract class AbstractEntityTest extends TestCase abstract class AbstractEntityTest extends TestCase
{ {
protected function assertBudget(EntityWithBudget $entityWithBudget) public function assertBudget(EntityWithBudget $entityWithBudget): void
{ {
$this->assertEquals(0.0, $entityWithBudget->getBudget()); $this->assertEquals(0.0, $entityWithBudget->getBudget());
$this->assertEquals(0, $entityWithBudget->getTimeBudget()); $this->assertEquals(0, $entityWithBudget->getTimeBudget());

View File

@@ -23,7 +23,7 @@ abstract class AbstractMetaEntityTest extends TestCase
abstract protected function getMetaEntity(): MetaTableTypeInterface; abstract protected function getMetaEntity(): MetaTableTypeInterface;
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = $this->getMetaEntity(); $sut = $this->getMetaEntity();
self::assertNull($sut->getLabel()); self::assertNull($sut->getLabel());
@@ -40,7 +40,7 @@ abstract class AbstractMetaEntityTest extends TestCase
self::assertEquals(0, $sut->getOrder()); self::assertEquals(0, $sut->getOrder());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = $this->getMetaEntity(); $sut = $this->getMetaEntity();
self::assertInstanceOf(MetaTableTypeInterface::class, $sut->setName('foo-bar')); self::assertInstanceOf(MetaTableTypeInterface::class, $sut->setName('foo-bar'));
@@ -85,7 +85,7 @@ abstract class AbstractMetaEntityTest extends TestCase
self::assertSame($entity, $sut->getEntity()); self::assertSame($entity, $sut->getEntity());
} }
public function testMerge() public function testMerge(): void
{ {
$entity1 = $this->getEntity(); $entity1 = $this->getEntity();
$entity2 = $this->getEntity(); $entity2 = $this->getEntity();

View File

@@ -30,7 +30,7 @@ class ActivityMetaTest extends AbstractMetaEntityTest
return new ActivityMeta(); return new ActivityMeta();
} }
public function testSetEntityThrowsException() public function testSetEntityThrowsException(): void
{ {
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expected instanceof Activity, received "App\Entity\Timesheet"'); $this->expectExceptionMessage('Expected instanceof Activity, received "App\Entity\Timesheet"');

View File

@@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class ActivityRateTest extends TestCase class ActivityRateTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new ActivityRate(); $sut = new ActivityRate();
self::assertNull($sut->getId()); self::assertNull($sut->getId());
@@ -32,7 +32,7 @@ class ActivityRateTest extends TestCase
self::assertFalse($sut->isFixed()); self::assertFalse($sut->isFixed());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new ActivityRate(); $sut = new ActivityRate();

View File

@@ -23,7 +23,7 @@ use Doctrine\Common\Collections\Collection;
*/ */
class ActivityTest extends AbstractEntityTest class ActivityTest extends AbstractEntityTest
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Activity(); $sut = new Activity();
$this->assertNull($sut->getId()); $this->assertNull($sut->getId());
@@ -42,12 +42,12 @@ class ActivityTest extends AbstractEntityTest
$this->assertInstanceOf(Collection::class, $sut->getTeams()); $this->assertInstanceOf(Collection::class, $sut->getTeams());
} }
public function testBudgets() public function testBudgets(): void
{ {
$this->assertBudget(new Activity()); $this->assertBudget(new Activity());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new Activity(); $sut = new Activity();
$this->assertInstanceOf(Activity::class, $sut->setName('foo-bar')); $this->assertInstanceOf(Activity::class, $sut->setName('foo-bar'));
@@ -82,7 +82,7 @@ class ActivityTest extends AbstractEntityTest
$this->assertFalse($sut->isGlobal()); $this->assertFalse($sut->isGlobal());
} }
public function testMetaFields() public function testMetaFields(): void
{ {
$sut = new Activity(); $sut = new Activity();
$meta = new ActivityMeta(); $meta = new ActivityMeta();
@@ -110,7 +110,7 @@ class ActivityTest extends AbstractEntityTest
self::assertCount(2, $sut->getVisibleMetaFields()); self::assertCount(2, $sut->getVisibleMetaFields());
} }
public function testTeams() public function testTeams(): void
{ {
$sut = new Activity(); $sut = new Activity();
$team = new Team('foo'); $team = new Team('foo');
@@ -133,7 +133,7 @@ class ActivityTest extends AbstractEntityTest
self::assertCount(0, $team->getActivities()); self::assertCount(0, $team->getActivities());
} }
public function testExportAnnotations() public function testExportAnnotations(): void
{ {
$sut = new AnnotationExtractor(); $sut = new AnnotationExtractor();
@@ -169,7 +169,7 @@ class ActivityTest extends AbstractEntityTest
} }
} }
public function testClone() public function testClone(): void
{ {
$sut = new Activity(); $sut = new Activity();
$sut->setName('activity1111'); $sut->setName('activity1111');

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class BookmarkTest extends TestCase class BookmarkTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Bookmark(); $sut = new Bookmark();
$this->assertNull($sut->getId()); $this->assertNull($sut->getId());
@@ -29,7 +29,7 @@ class BookmarkTest extends TestCase
$this->assertNull($sut->getUser()); $this->assertNull($sut->getUser());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new Bookmark(); $sut = new Bookmark();
$sut->setName('foo-bar'); $sut->setName('foo-bar');

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class ConfigurationTest extends TestCase class ConfigurationTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Configuration(); $sut = new Configuration();
$this->assertNull($sut->getId()); $this->assertNull($sut->getId());
@@ -25,7 +25,7 @@ class ConfigurationTest extends TestCase
$this->assertNull($sut->getValue()); $this->assertNull($sut->getValue());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new Configuration(); $sut = new Configuration();
$this->assertInstanceOf(Configuration::class, $sut->setName('foo-bar')); $this->assertInstanceOf(Configuration::class, $sut->setName('foo-bar'));

View File

@@ -23,7 +23,7 @@ class CustomerCommentTest extends AbstractCommentEntityTest
return new CustomerComment(new Customer('foo')); return new CustomerComment(new Customer('foo'));
} }
public function testEntitySpecificMethods() public function testEntitySpecificMethods(): void
{ {
$sut = $this->getEntity(); $sut = $this->getEntity();
self::assertNotNull($sut->getCustomer()); self::assertNotNull($sut->getCustomer());

View File

@@ -30,7 +30,7 @@ class CustomerMetaTest extends AbstractMetaEntityTest
return new CustomerMeta(); return new CustomerMeta();
} }
public function testSetEntityThrowsException() public function testSetEntityThrowsException(): void
{ {
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expected instanceof Customer, received "App\Entity\Activity"'); $this->expectExceptionMessage('Expected instanceof Customer, received "App\Entity\Activity"');

View File

@@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class CustomerRateTest extends TestCase class CustomerRateTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new CustomerRate(); $sut = new CustomerRate();
self::assertNull($sut->getId()); self::assertNull($sut->getId());
@@ -32,7 +32,7 @@ class CustomerRateTest extends TestCase
self::assertFalse($sut->isFixed()); self::assertFalse($sut->isFixed());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new CustomerRate(); $sut = new CustomerRate();

View File

@@ -22,7 +22,7 @@ use Doctrine\Common\Collections\Collection;
*/ */
class CustomerTest extends AbstractEntityTest class CustomerTest extends AbstractEntityTest
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Customer('foo'); $sut = new Customer('foo');
self::assertNull($sut->getId()); self::assertNull($sut->getId());
@@ -54,12 +54,12 @@ class CustomerTest extends AbstractEntityTest
self::assertEquals(0, $sut->getTeams()->count()); self::assertEquals(0, $sut->getTeams()->count());
} }
public function testBudgets() public function testBudgets(): void
{ {
$this->assertBudget(new Customer('foo')); $this->assertBudget(new Customer('foo'));
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new Customer('foo-bar'); $sut = new Customer('foo-bar');
self::assertEquals('foo-bar', $sut->getName()); self::assertEquals('foo-bar', $sut->getName());
@@ -119,7 +119,7 @@ class CustomerTest extends AbstractEntityTest
self::assertNull($sut->getCurrency()); self::assertNull($sut->getCurrency());
} }
public function testMetaFields() public function testMetaFields(): void
{ {
$sut = new Customer('foo'); $sut = new Customer('foo');
$meta = new CustomerMeta(); $meta = new CustomerMeta();
@@ -147,7 +147,7 @@ class CustomerTest extends AbstractEntityTest
self::assertCount(2, $sut->getVisibleMetaFields()); self::assertCount(2, $sut->getVisibleMetaFields());
} }
public function testTeams() public function testTeams(): void
{ {
$sut = new Customer('foo'); $sut = new Customer('foo');
$team = new Team('foo'); $team = new Team('foo');
@@ -171,7 +171,7 @@ class CustomerTest extends AbstractEntityTest
self::assertCount(0, $team->getCustomers()); self::assertCount(0, $team->getCustomers());
} }
public function testExportAnnotations() public function testExportAnnotations(): void
{ {
$sut = new AnnotationExtractor(); $sut = new AnnotationExtractor();
@@ -219,7 +219,7 @@ class CustomerTest extends AbstractEntityTest
} }
} }
public function testClone() public function testClone(): void
{ {
$sut = new Customer('mycustomer'); $sut = new Customer('mycustomer');
$sut->setVatId('DE-0123456789'); $sut->setVatId('DE-0123456789');

View File

@@ -21,7 +21,7 @@ trait EntityValidationTestTrait
* @param object $entity * @param object $entity
* @param array|string $fieldNames * @param array|string $fieldNames
*/ */
protected function assertHasViolationForField(object $entity, $fieldNames, $groups = null) public function assertHasViolationForField(object $entity, $fieldNames, $groups = null): void
{ {
self::bootKernel(); self::bootKernel();
/** @var ValidatorInterface $validator */ /** @var ValidatorInterface $validator */
@@ -56,7 +56,7 @@ trait EntityValidationTestTrait
$this->assertEquals($expected, $countViolations, sprintf('Expected %s violations, found %s in %s.', $expected, $actual, implode(', ', array_keys($violatedFields)))); $this->assertEquals($expected, $countViolations, sprintf('Expected %s violations, found %s in %s.', $expected, $actual, implode(', ', array_keys($violatedFields))));
} }
protected function assertHasNoViolations($entity, $groups = null) public function assertHasNoViolations($entity, $groups = null): void
{ {
self::bootKernel(); self::bootKernel();
/** @var ValidatorInterface $validator */ /** @var ValidatorInterface $validator */

View File

@@ -30,7 +30,7 @@ class InvoiceMetaTest extends AbstractMetaEntityTest
return new InvoiceMeta(); return new InvoiceMeta();
} }
public function testSetEntityThrowsException() public function testSetEntityThrowsException(): void
{ {
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expected instanceof Invoice, received "App\Entity\Customer"'); $this->expectExceptionMessage('Expected instanceof Invoice, received "App\Entity\Customer"');

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class InvoiceTemplateTest extends TestCase class InvoiceTemplateTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new InvoiceTemplate(); $sut = new InvoiceTemplate();
@@ -38,7 +38,7 @@ class InvoiceTemplateTest extends TestCase
self::assertTrue($sut->isDecimalDuration()); self::assertTrue($sut->isDecimalDuration());
} }
public function testSetNullForOptionalValues() public function testSetNullForOptionalValues(): void
{ {
$sut = new InvoiceTemplate(); $sut = new InvoiceTemplate();
@@ -49,7 +49,7 @@ class InvoiceTemplateTest extends TestCase
self::assertInstanceOf(InvoiceTemplate::class, $sut->setPaymentTerms(null)); self::assertInstanceOf(InvoiceTemplate::class, $sut->setPaymentTerms(null));
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new InvoiceTemplate(); $sut = new InvoiceTemplate();
@@ -83,7 +83,7 @@ class InvoiceTemplateTest extends TestCase
self::assertEquals($sut, clone $sut); self::assertEquals($sut, clone $sut);
} }
public function testToString() public function testToString(): void
{ {
$sut = new InvoiceTemplate(); $sut = new InvoiceTemplate();

View File

@@ -35,7 +35,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class InvoiceTest extends TestCase class InvoiceTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Invoice(); $sut = new Invoice();
self::assertNull($sut->getCreatedAt()); self::assertNull($sut->getCreatedAt());
@@ -58,7 +58,7 @@ class InvoiceTest extends TestCase
self::assertNull($sut->getComment()); self::assertNull($sut->getComment());
} }
public function testSetInvalidStatus() public function testSetInvalidStatus(): void
{ {
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown invoice status'); $this->expectExceptionMessage('Unknown invoice status');
@@ -67,7 +67,7 @@ class InvoiceTest extends TestCase
$sut->setStatus('foo'); $sut->setStatus('foo');
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$date = new \DateTime('-2 months'); $date = new \DateTime('-2 months');
$sut = new Invoice(); $sut = new Invoice();
@@ -219,7 +219,7 @@ class InvoiceTest extends TestCase
return new DateNumberGenerator($repository); return new DateNumberGenerator($repository);
} }
public function testClone() public function testClone(): void
{ {
$sut = new Invoice(); $sut = new Invoice();
$sut->setComment('foo kajsdhgf aksjdhfg'); $sut->setComment('foo kajsdhgf aksjdhfg');
@@ -242,7 +242,7 @@ class InvoiceTest extends TestCase
self::assertEquals('foo kajsdhgf aksjdhfg', $clone->getComment()); self::assertEquals('foo kajsdhgf aksjdhfg', $clone->getComment());
} }
public function testMetaFields() public function testMetaFields(): void
{ {
$sut = new Invoice(); $sut = new Invoice();

View File

@@ -23,7 +23,7 @@ class ProjectCommentTest extends AbstractCommentEntityTest
return new ProjectComment(new Project()); return new ProjectComment(new Project());
} }
public function testEntitySpecificMethods() public function testEntitySpecificMethods(): void
{ {
$sut = $this->getEntity(); $sut = $this->getEntity();
self::assertNotNull($sut->getProject()); self::assertNotNull($sut->getProject());

View File

@@ -30,7 +30,7 @@ class ProjectMetaTest extends AbstractMetaEntityTest
return new ProjectMeta(); return new ProjectMeta();
} }
public function testSetEntityThrowsException() public function testSetEntityThrowsException(): void
{ {
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expected instanceof Project, received "App\Entity\Customer"'); $this->expectExceptionMessage('Expected instanceof Project, received "App\Entity\Customer"');

View File

@@ -20,7 +20,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class ProjectRateTest extends TestCase class ProjectRateTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new ProjectRate(); $sut = new ProjectRate();
self::assertNull($sut->getId()); self::assertNull($sut->getId());
@@ -32,7 +32,7 @@ class ProjectRateTest extends TestCase
self::assertFalse($sut->isFixed()); self::assertFalse($sut->isFixed());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new ProjectRate(); $sut = new ProjectRate();

View File

@@ -23,7 +23,7 @@ use Doctrine\Common\Collections\Collection;
*/ */
class ProjectTest extends AbstractEntityTest class ProjectTest extends AbstractEntityTest
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Project(); $sut = new Project();
self::assertNull($sut->getId()); self::assertNull($sut->getId());
@@ -48,12 +48,12 @@ class ProjectTest extends AbstractEntityTest
self::assertTrue($sut->isVisibleAtDate(new \DateTime())); self::assertTrue($sut->isVisibleAtDate(new \DateTime()));
} }
public function testBudgets() public function testBudgets(): void
{ {
$this->assertBudget(new Project()); $this->assertBudget(new Project());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new Project(); $sut = new Project();
@@ -110,7 +110,7 @@ class ProjectTest extends AbstractEntityTest
self::assertFalse($sut->isGlobalActivities()); self::assertFalse($sut->isGlobalActivities());
} }
public function testMetaFields() public function testMetaFields(): void
{ {
$sut = new Project(); $sut = new Project();
$meta = new ProjectMeta(); $meta = new ProjectMeta();
@@ -138,7 +138,7 @@ class ProjectTest extends AbstractEntityTest
self::assertCount(2, $sut->getVisibleMetaFields()); self::assertCount(2, $sut->getVisibleMetaFields());
} }
public function testTeams() public function testTeams(): void
{ {
$sut = new Project(); $sut = new Project();
$team = new Team('foo'); $team = new Team('foo');
@@ -161,7 +161,7 @@ class ProjectTest extends AbstractEntityTest
self::assertCount(0, $team->getProjects()); self::assertCount(0, $team->getProjects());
} }
public function testExportAnnotations() public function testExportAnnotations(): void
{ {
$sut = new AnnotationExtractor(); $sut = new AnnotationExtractor();
@@ -201,7 +201,7 @@ class ProjectTest extends AbstractEntityTest
} }
} }
public function testClone() public function testClone(): void
{ {
$customer = new Customer('prj-customer'); $customer = new Customer('prj-customer');
$customer->setVatId('DE-0123456789'); $customer->setVatId('DE-0123456789');
@@ -241,7 +241,7 @@ class ProjectTest extends AbstractEntityTest
self::assertEquals('prj-customer', $clone->getCustomer()->getName()); self::assertEquals('prj-customer', $clone->getCustomer()->getName());
} }
public function testIsVisibleAtDateTime() public function testIsVisibleAtDateTime(): void
{ {
$now = new \DateTime(); $now = new \DateTime();

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class RolePermissionTest extends TestCase class RolePermissionTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new RolePermission(); $sut = new RolePermission();
self::assertNull($sut->getId()); self::assertNull($sut->getId());
@@ -27,7 +27,7 @@ class RolePermissionTest extends TestCase
self::assertFalse($sut->isAllowed()); self::assertFalse($sut->isAllowed());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new RolePermission(); $sut = new RolePermission();

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class TagTest extends TestCase class TagTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Tag(); $sut = new Tag();
$this->assertNull($sut->getId()); $this->assertNull($sut->getId());
@@ -25,7 +25,7 @@ class TagTest extends TestCase
$this->assertNull($sut->getColor()); $this->assertNull($sut->getColor());
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new Tag(); $sut = new Tag();

View File

@@ -24,7 +24,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class TeamTest extends TestCase class TeamTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new Team('foo'); $sut = new Team('foo');
self::assertNull($sut->getId()); self::assertNull($sut->getId());
@@ -40,7 +40,7 @@ class TeamTest extends TestCase
self::assertEquals(0, $sut->getActivities()->count()); self::assertEquals(0, $sut->getActivities()->count());
} }
public function testColor() public function testColor(): void
{ {
$sut = new Team('foo'); $sut = new Team('foo');
self::assertNull($sut->getColor()); self::assertNull($sut->getColor());
@@ -55,7 +55,7 @@ class TeamTest extends TestCase
self::assertTrue($sut->hasColor()); self::assertTrue($sut->hasColor());
} }
public function testTeamMemberships() public function testTeamMemberships(): void
{ {
$user = new User(); $user = new User();
$user2 = new User(); $user2 = new User();
@@ -115,7 +115,7 @@ class TeamTest extends TestCase
self::assertCount(2, $sut->getMembers()); self::assertCount(2, $sut->getMembers());
} }
public function testTeamMembershipsException() public function testTeamMembershipsException(): void
{ {
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
$sut = new Team('foo'); $sut = new Team('foo');
@@ -124,7 +124,7 @@ class TeamTest extends TestCase
$sut->addMember($member); $sut->addMember($member);
} }
public function testSetterAndGetter() public function testSetterAndGetter(): void
{ {
$sut = new Team('foo-bar'); $sut = new Team('foo-bar');
self::assertEquals('foo-bar', $sut->getName()); self::assertEquals('foo-bar', $sut->getName());
@@ -156,7 +156,7 @@ class TeamTest extends TestCase
self::assertCount(2, $sut->getTeamleads()); self::assertCount(2, $sut->getTeamleads());
} }
public function testCustomer() public function testCustomer(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
self::assertEmpty($customer->getTeams()); self::assertEmpty($customer->getTeams());
@@ -175,7 +175,7 @@ class TeamTest extends TestCase
self::assertEquals(0, $sut->getCustomers()->count()); self::assertEquals(0, $sut->getCustomers()->count());
} }
public function testProject() public function testProject(): void
{ {
$project = new Project(); $project = new Project();
$project->setName('foo'); $project->setName('foo');
@@ -195,7 +195,7 @@ class TeamTest extends TestCase
self::assertEquals(0, $sut->getProjects()->count()); self::assertEquals(0, $sut->getProjects()->count());
} }
public function testActivities() public function testActivities(): void
{ {
$activity = new Activity(); $activity = new Activity();
$activity->setName('foo'); $activity->setName('foo');
@@ -215,7 +215,7 @@ class TeamTest extends TestCase
self::assertEquals(0, $sut->getActivities()->count()); self::assertEquals(0, $sut->getActivities()->count());
} }
public function testUsers() public function testUsers(): void
{ {
$user = new User(); $user = new User();
$user->setAlias('foo'); $user->setAlias('foo');
@@ -241,7 +241,7 @@ class TeamTest extends TestCase
self::assertCount(1, $sut->getUsers()); self::assertCount(1, $sut->getUsers());
} }
public function testClone() public function testClone(): void
{ {
$c = new Customer('Foo'); $c = new Customer('Foo');
$p = new Project(); $p = new Project();

View File

@@ -30,7 +30,7 @@ class TimesheetMetaTest extends AbstractMetaEntityTest
return new TimesheetMeta(); return new TimesheetMeta();
} }
public function testSetEntityThrowsException() public function testSetEntityThrowsException(): void
{ {
$this->expectException(\InvalidArgumentException::class); $this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expected instanceof Timesheet, received "App\Entity\Project"'); $this->expectExceptionMessage('Expected instanceof Timesheet, received "App\Entity\Project"');

View File

@@ -44,7 +44,7 @@ class TimesheetValidationTest extends KernelTestCase
return $entity; return $entity;
} }
public function testValidationNeedsActivity() public function testValidationNeedsActivity(): void
{ {
$project = new Project(); $project = new Project();
$project->setCustomer(new Customer('foo')); $project->setCustomer(new Customer('foo'));
@@ -57,7 +57,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'activity'); $this->assertHasViolationForField($entity, 'activity');
} }
public function testValidationNeedsProject() public function testValidationNeedsProject(): void
{ {
$entity = new Timesheet(); $entity = new Timesheet();
$entity->setUser(new User()); $entity->setUser(new User());
@@ -67,7 +67,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'project'); $this->assertHasViolationForField($entity, 'project');
} }
public function testValidationProjectMismatch() public function testValidationProjectMismatch(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$project = (new Project())->setName('foo')->setCustomer($customer); $project = (new Project())->setName('foo')->setCustomer($customer);
@@ -83,7 +83,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'project'); $this->assertHasViolationForField($entity, 'project');
} }
public function testValidationCustomerInvisible() public function testValidationCustomerInvisible(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$customer->setVisible(false); $customer->setVisible(false);
@@ -124,7 +124,7 @@ class TimesheetValidationTest extends KernelTestCase
return $entity; return $entity;
} }
public function testValidationCustomerInvisibleDoesNotTriggerOnStoppedEntities() public function testValidationCustomerInvisibleDoesNotTriggerOnStoppedEntities(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$customer->setVisible(false); $customer->setVisible(false);
@@ -140,7 +140,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasNoViolations($entity); $this->assertHasNoViolations($entity);
} }
public function testValidationCustomerInvisibleDoesTriggerOnNewEntities() public function testValidationCustomerInvisibleDoesTriggerOnNewEntities(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$customer->setVisible(false); $customer->setVisible(false);
@@ -156,7 +156,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'customer'); $this->assertHasViolationForField($entity, 'customer');
} }
public function testValidationProjectInvisible() public function testValidationProjectInvisible(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$project = (new Project())->setName('foo')->setCustomer($customer)->setVisible(false); $project = (new Project())->setName('foo')->setCustomer($customer)->setVisible(false);
@@ -172,7 +172,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'project'); $this->assertHasViolationForField($entity, 'project');
} }
public function testValidationProjectInvisibleDoesNotTriggerOnStoppedEntities() public function testValidationProjectInvisibleDoesNotTriggerOnStoppedEntities(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$project = (new Project())->setName('foo')->setCustomer($customer)->setVisible(false); $project = (new Project())->setName('foo')->setCustomer($customer)->setVisible(false);
@@ -183,7 +183,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasNoViolations($entity); $this->assertHasNoViolations($entity);
} }
public function testValidationProjectInvisibleDoesTriggerOnNewEntities() public function testValidationProjectInvisibleDoesTriggerOnNewEntities(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$project = (new Project())->setName('foo')->setCustomer($customer)->setVisible(false); $project = (new Project())->setName('foo')->setCustomer($customer)->setVisible(false);
@@ -194,7 +194,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'project'); $this->assertHasViolationForField($entity, 'project');
} }
public function testValidationActivityInvisible() public function testValidationActivityInvisible(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$project = (new Project())->setName('foo')->setCustomer($customer); $project = (new Project())->setName('foo')->setCustomer($customer);
@@ -210,7 +210,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'activity'); $this->assertHasViolationForField($entity, 'activity');
} }
public function testValidationActivityInvisibleDoesNotTriggerOnStoppedEntities() public function testValidationActivityInvisibleDoesNotTriggerOnStoppedEntities(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$project = new Project(); $project = new Project();
@@ -226,7 +226,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasNoViolations($entity); $this->assertHasNoViolations($entity);
} }
public function testValidationActivityInvisibleDoesTriggerOnNewEntities() public function testValidationActivityInvisibleDoesTriggerOnNewEntities(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$project = new Project(); $project = new Project();
@@ -242,7 +242,7 @@ class TimesheetValidationTest extends KernelTestCase
$this->assertHasViolationForField($entity, 'activity'); $this->assertHasViolationForField($entity, 'activity');
} }
public function testValidationEndNotEarlierThanBegin() public function testValidationEndNotEarlierThanBegin(): void
{ {
$entity = $this->getEntity(); $entity = $this->getEntity();
$begin = new \DateTime(); $begin = new \DateTime();

View File

@@ -20,7 +20,7 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
*/ */
class UserPreferenceTest extends TestCase class UserPreferenceTest extends TestCase
{ {
public function testDefaultValues() public function testDefaultValues(): void
{ {
$sut = new UserPreference('foo'); $sut = new UserPreference('foo');
self::assertTrue($sut->isEnabled()); self::assertTrue($sut->isEnabled());
@@ -38,7 +38,7 @@ class UserPreferenceTest extends TestCase
self::assertNull($sut->getUser()); self::assertNull($sut->getUser());
} }
public function testGetValueChangesReturnTypeOnOtherType() public function testGetValueChangesReturnTypeOnOtherType(): void
{ {
$sut = new UserPreference('foo'); $sut = new UserPreference('foo');
$sut->setValue('1'); $sut->setValue('1');
@@ -52,7 +52,7 @@ class UserPreferenceTest extends TestCase
self::assertFalse($sut->getValue()); self::assertFalse($sut->getValue());
} }
public function testGetLabelWithLabelOption() public function testGetLabelWithLabelOption(): void
{ {
$sut = new UserPreference('foo'); $sut = new UserPreference('foo');
self::assertEquals('foo', $sut->getLabel()); self::assertEquals('foo', $sut->getLabel());

View File

@@ -116,7 +116,7 @@ class UserTest extends TestCase
$user->setWorkHoursFriday(7600); $user->setWorkHoursFriday(7600);
$user->setWorkHoursSaturday(7700); $user->setWorkHoursSaturday(7700);
$user->setWorkHoursSunday(7800); $user->setWorkHoursSunday(7800);
$user->setHolidaysPerYear(10); $user->setHolidaysPerYear(10.7);
self::assertTrue($user->hasWorkHourConfiguration()); self::assertTrue($user->hasWorkHourConfiguration());
self::assertEquals(7200, $user->getWorkHoursMonday()); self::assertEquals(7200, $user->getWorkHoursMonday());
@@ -126,7 +126,7 @@ class UserTest extends TestCase
self::assertEquals(7600, $user->getWorkHoursFriday()); self::assertEquals(7600, $user->getWorkHoursFriday());
self::assertEquals(7700, $user->getWorkHoursSaturday()); self::assertEquals(7700, $user->getWorkHoursSaturday());
self::assertEquals(7800, $user->getWorkHoursSunday()); self::assertEquals(7800, $user->getWorkHoursSunday());
self::assertEquals(10, $user->getHolidaysPerYear()); self::assertEquals(10.5, $user->getHolidaysPerYear());
self::assertEquals(7200, $user->getWorkHoursForDay($monday)); self::assertEquals(7200, $user->getWorkHoursForDay($monday));
self::assertEquals(7300, $user->getWorkHoursForDay($tuesday)); self::assertEquals(7300, $user->getWorkHoursForDay($tuesday));

View File

@@ -18,7 +18,7 @@ abstract class AbstractActivityEventTest extends TestCase
{ {
abstract protected function createActivityEvent(Activity $activity): AbstractActivityEvent; abstract protected function createActivityEvent(Activity $activity): AbstractActivityEvent;
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$activity = new Activity(); $activity = new Activity();
$sut = $this->createActivityEvent($activity); $sut = $this->createActivityEvent($activity);

View File

@@ -18,7 +18,7 @@ abstract class AbstractCustomerEventTest extends TestCase
{ {
abstract protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent; abstract protected function createCustomerEvent(Customer $customer): AbstractCustomerEvent;
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$sut = $this->createCustomerEvent($customer); $sut = $this->createCustomerEvent($customer);

View File

@@ -18,7 +18,7 @@ abstract class AbstractProjectEventTest extends TestCase
{ {
abstract protected function createProjectEvent(Project $project): AbstractProjectEvent; abstract protected function createProjectEvent(Project $project): AbstractProjectEvent;
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$project = new Project(); $project = new Project();
$sut = $this->createProjectEvent($project); $sut = $this->createProjectEvent($project);

View File

@@ -18,7 +18,7 @@ abstract class AbstractTimesheetEventTest extends TestCase
{ {
abstract protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent; abstract protected function createTimesheetEvent(Timesheet $timesheet): AbstractTimesheetEvent;
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$timesheet = new Timesheet(); $timesheet = new Timesheet();
$sut = $this->createTimesheetEvent($timesheet); $sut = $this->createTimesheetEvent($timesheet);

View File

@@ -18,7 +18,7 @@ abstract class AbstractTimesheetMultipleEventTest extends TestCase
{ {
abstract protected function createTimesheetMultipleEvent(array $timesheets): AbstractTimesheetMultipleEvent; abstract protected function createTimesheetMultipleEvent(array $timesheets): AbstractTimesheetMultipleEvent;
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$timesheets = [new Timesheet(), new Timesheet()]; $timesheets = [new Timesheet(), new Timesheet()];
$sut = $this->createTimesheetMultipleEvent($timesheets); $sut = $this->createTimesheetMultipleEvent($timesheets);

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class ActivityMetaDefinitionEventTest extends TestCase class ActivityMetaDefinitionEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$activity = new Activity(); $activity = new Activity();
$sut = new ActivityMetaDefinitionEvent($activity); $sut = new ActivityMetaDefinitionEvent($activity);

View File

@@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class ActivityMetaDisplayEventTest extends TestCase class ActivityMetaDisplayEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$query = new ActivityQuery(); $query = new ActivityQuery();
$sut = new ActivityMetaDisplayEvent($query, ActivityMetaDisplayEvent::EXPORT); $sut = new ActivityMetaDisplayEvent($query, ActivityMetaDisplayEvent::EXPORT);

View File

@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class CalendarConfigurationEventTest extends TestCase class CalendarConfigurationEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$configuration = [ $configuration = [
'a' => 'b', 'a' => 'b',

View File

@@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class CalendarDragAndDropSourceEventTest extends TestCase class CalendarDragAndDropSourceEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$user = new User(); $user = new User();
$user->setAlias('foo'); $user->setAlias('foo');

View File

@@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class CalendarGoogleSourceEventTest extends TestCase class CalendarGoogleSourceEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$user = new User(); $user = new User();
$user->setAlias('foo'); $user->setAlias('foo');

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class CustomerMetaDefinitionEventTest extends TestCase class CustomerMetaDefinitionEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$sut = new CustomerMetaDefinitionEvent($customer); $sut = new CustomerMetaDefinitionEvent($customer);

View File

@@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class CustomerMetaDisplayEventTest extends TestCase class CustomerMetaDisplayEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$query = new CustomerQuery(); $query = new CustomerQuery();
$sut = new CustomerMetaDisplayEvent($query, CustomerMetaDisplayEvent::EXPORT); $sut = new CustomerMetaDisplayEvent($query, CustomerMetaDisplayEvent::EXPORT);

View File

@@ -25,7 +25,7 @@ class CustomerStatisticEventTest extends AbstractCustomerEventTest
return new CustomerStatisticEvent($customer, new CustomerStatistic()); return new CustomerStatisticEvent($customer, new CustomerStatistic());
} }
public function testStatistic() public function testStatistic(): void
{ {
$customer = new Customer('foo'); $customer = new Customer('foo');
$statistic = new CustomerStatistic(); $statistic = new CustomerStatistic();

View File

@@ -18,7 +18,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class DashboardEventTest extends TestCase class DashboardEventTest extends TestCase
{ {
public function testGetterAndSetter() public function testGetterAndSetter(): void
{ {
$user = new User(); $user = new User();
$user->setAlias('foo'); $user->setAlias('foo');

Some files were not shown because too many files have changed in this diff Show More