Release 2.12 (#4609)
This commit is contained in:
@@ -20,12 +20,12 @@ use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
*/
|
||||
class ActionsControllerTest extends APIControllerBaseTest
|
||||
{
|
||||
public function testIsSecure()
|
||||
public function testIsSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/api/actions/timesheet/1/index/en');
|
||||
}
|
||||
|
||||
public function test_getTimesheetActions()
|
||||
public function test_getTimesheetActions(): void
|
||||
{
|
||||
$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);
|
||||
|
||||
@@ -121,7 +121,7 @@ class ActionsControllerTest extends APIControllerBaseTest
|
||||
}
|
||||
}
|
||||
|
||||
public function test_getProjectActions()
|
||||
public function test_getProjectActions(): void
|
||||
{
|
||||
$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);
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
return [$rate1, $rate2];
|
||||
}
|
||||
|
||||
public function testIsSecure()
|
||||
public function testIsSecure(): void
|
||||
{
|
||||
$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]]];
|
||||
}
|
||||
|
||||
public function testGetCollectionWithQuery()
|
||||
public function testGetCollectionWithQuery(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$imports = $this->loadActivityTestData();
|
||||
@@ -219,7 +219,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertEquals($imports[1]->getId(), $result[2]['project']);
|
||||
}
|
||||
|
||||
public function testGetEntity()
|
||||
public function testGetEntity(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/api/activities/1');
|
||||
@@ -229,12 +229,12 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
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.');
|
||||
}
|
||||
|
||||
public function testPostAction()
|
||||
public function testPostAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -253,7 +253,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPostActionWithLeastFields()
|
||||
public function testPostActionWithLeastFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -268,7 +268,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPostActionWithInvalidUser()
|
||||
public function testPostActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$data = [
|
||||
@@ -281,7 +281,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiResponseAccessDenied($response, 'User cannot create activities');
|
||||
}
|
||||
|
||||
public function testPostActionWithInvalidData()
|
||||
public function testPostActionWithInvalidData(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -295,7 +295,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['project'], true);
|
||||
}
|
||||
|
||||
public function testPatchAction()
|
||||
public function testPatchAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -314,7 +314,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPatchActionWithNonGlobalActivity()
|
||||
public function testPatchActionWithNonGlobalActivity(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$imports = $this->loadActivityTestData();
|
||||
@@ -337,7 +337,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertEquals($imports[1]->getId(), $result['project']);
|
||||
}
|
||||
|
||||
public function testPatchActionWithInvalidUser()
|
||||
public function testPatchActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
@@ -352,12 +352,12 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiResponseAccessDenied($response, 'User cannot update activity');
|
||||
}
|
||||
|
||||
public function testPatchActionWithUnknownActivity()
|
||||
public function testPatchActionWithUnknownActivity(): void
|
||||
{
|
||||
$this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/activities/255', []);
|
||||
}
|
||||
|
||||
public function testInvalidPatchAction()
|
||||
public function testInvalidPatchAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -371,12 +371,12 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['name']);
|
||||
}
|
||||
|
||||
public function testMetaActionThrowsNotFound()
|
||||
public function testMetaActionThrowsNotFound(): void
|
||||
{
|
||||
$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'], [
|
||||
'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'], [
|
||||
'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'], [
|
||||
'code' => 404,
|
||||
@@ -400,7 +400,7 @@ class ActivityControllerTest extends APIControllerBaseTest
|
||||
]);
|
||||
}
|
||||
|
||||
public function testMetaAction()
|
||||
public function testMetaAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
static::getContainer()->get('event_dispatcher')->addSubscriber(new ActivityTestMetaFieldSubscriberMock());
|
||||
|
||||
@@ -41,7 +41,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
return new SessionAuthenticator($token);
|
||||
}
|
||||
|
||||
public function testSupports()
|
||||
public function testSupports(): void
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
|
||||
@@ -65,7 +65,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
self::assertFalse($sut->supports($request));
|
||||
}
|
||||
|
||||
public function testAuthenticateWithMissingAuthHeader()
|
||||
public function testAuthenticateWithMissingAuthHeader(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
|
||||
@@ -76,7 +76,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithMissingToken()
|
||||
public function testAuthenticateWithMissingToken(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
|
||||
@@ -87,7 +87,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithEmptyToken()
|
||||
public function testAuthenticateWithEmptyToken(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
|
||||
@@ -98,7 +98,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithMissingUser()
|
||||
public function testAuthenticateWithMissingUser(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
|
||||
@@ -109,7 +109,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithEmptyUser()
|
||||
public function testAuthenticateWithEmptyUser(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
|
||||
@@ -120,7 +120,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticate()
|
||||
public function testAuthenticate(): void
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
|
||||
@@ -141,7 +141,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
self::assertTrue($badge->isResolved());
|
||||
}
|
||||
|
||||
public function testAuthenticateFailsOnMissingApiTokenForUser()
|
||||
public function testAuthenticateFailsOnMissingApiTokenForUser(): void
|
||||
{
|
||||
$this->expectException(BadCredentialsException::class);
|
||||
$this->expectExceptionMessage('The user has no activated API account.');
|
||||
@@ -158,7 +158,7 @@ class SessionAuthenticatorTest extends TestCase
|
||||
$badge->executeCustomChecker($user);
|
||||
}
|
||||
|
||||
public function testAuthenticateFailsOnWrongPassword()
|
||||
public function testAuthenticateFailsOnWrongPassword(): void
|
||||
{
|
||||
$this->expectException(BadCredentialsException::class);
|
||||
$this->expectExceptionMessage('The presented password is invalid.');
|
||||
|
||||
@@ -38,7 +38,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
return new TokenAuthenticator($userProvider, $passwordHasherFactory);
|
||||
}
|
||||
|
||||
public function testSupports()
|
||||
public function testSupports(): void
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
|
||||
@@ -62,7 +62,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
self::assertTrue($sut->supports($request));
|
||||
}
|
||||
|
||||
public function testAuthenticateWithMissingAuthHeader()
|
||||
public function testAuthenticateWithMissingAuthHeader(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
|
||||
@@ -73,7 +73,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithMissingToken()
|
||||
public function testAuthenticateWithMissingToken(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
|
||||
@@ -84,7 +84,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithEmptyToken()
|
||||
public function testAuthenticateWithEmptyToken(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing token header: X-AUTH-TOKEN');
|
||||
@@ -95,7 +95,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithMissingUser()
|
||||
public function testAuthenticateWithMissingUser(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
|
||||
@@ -106,7 +106,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticateWithEmptyUser()
|
||||
public function testAuthenticateWithEmptyUser(): void
|
||||
{
|
||||
$this->expectException(CustomUserMessageAuthenticationException::class);
|
||||
$this->expectExceptionMessage('Authentication required, missing user header: X-AUTH-USER');
|
||||
@@ -117,7 +117,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
$sut->authenticate($request);
|
||||
}
|
||||
|
||||
public function testAuthenticate()
|
||||
public function testAuthenticate(): void
|
||||
{
|
||||
$sut = $this->getSut();
|
||||
|
||||
@@ -138,7 +138,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
self::assertTrue($badge->isResolved());
|
||||
}
|
||||
|
||||
public function testAuthenticateFailsOnMissingApiTokenForUser()
|
||||
public function testAuthenticateFailsOnMissingApiTokenForUser(): void
|
||||
{
|
||||
$this->expectException(BadCredentialsException::class);
|
||||
$this->expectExceptionMessage('The user has no activated API account.');
|
||||
@@ -155,7 +155,7 @@ class TokenAuthenticatorTest extends TestCase
|
||||
$badge->executeCustomChecker($user);
|
||||
}
|
||||
|
||||
public function testAuthenticateFailsOnWrongPassword()
|
||||
public function testAuthenticateFailsOnWrongPassword(): void
|
||||
{
|
||||
$this->expectException(BadCredentialsException::class);
|
||||
$this->expectExceptionMessage('The presented password is invalid.');
|
||||
|
||||
@@ -16,12 +16,12 @@ use App\Entity\User;
|
||||
*/
|
||||
class ConfigurationControllerTest extends APIControllerBaseTest
|
||||
{
|
||||
public function testIsTimesheetSecure()
|
||||
public function testIsTimesheetSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/api/config/timesheet');
|
||||
}
|
||||
|
||||
public function testGetTimesheet()
|
||||
public function testGetTimesheet(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/api/config/timesheet', 'GET');
|
||||
|
||||
@@ -87,12 +87,12 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
return [$rate1, $rate2];
|
||||
}
|
||||
|
||||
public function testIsSecure()
|
||||
public function testIsSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/api/customers');
|
||||
}
|
||||
|
||||
public function testGetCollection()
|
||||
public function testGetCollection(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/api/customers');
|
||||
@@ -104,7 +104,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
self::assertApiResponseTypeStructure('CustomerCollection', $result[0]);
|
||||
}
|
||||
|
||||
public function testGetCollectionWithQuery()
|
||||
public function testGetCollectionWithQuery(): void
|
||||
{
|
||||
$query = ['order' => 'ASC', 'orderBy' => 'name', 'visible' => 3, 'term' => 'test'];
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
@@ -117,7 +117,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
self::assertApiResponseTypeStructure('CustomerCollection', $result[0]);
|
||||
}
|
||||
|
||||
public function testGetEntity()
|
||||
public function testGetEntity(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/api/customers/1');
|
||||
@@ -127,7 +127,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
self::assertApiResponseTypeStructure('CustomerEntity', $result);
|
||||
}
|
||||
|
||||
public function testGetEntityWithFullResponse()
|
||||
public function testGetEntityWithFullResponse(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
@@ -171,12 +171,12 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
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.');
|
||||
}
|
||||
|
||||
public function testPostAction()
|
||||
public function testPostAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -197,7 +197,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPostActionWithLeastFields()
|
||||
public function testPostActionWithLeastFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -215,7 +215,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPostActionWithInvalidUser()
|
||||
public function testPostActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$data = [
|
||||
@@ -230,7 +230,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiResponseAccessDenied($response, 'User cannot create customers');
|
||||
}
|
||||
|
||||
public function testPostActionWithInvalidData()
|
||||
public function testPostActionWithInvalidData(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -246,7 +246,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['country', 'currency', 'timezone'], true);
|
||||
}
|
||||
|
||||
public function testPatchAction()
|
||||
public function testPatchAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -268,7 +268,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPatchActionWithInvalidUser()
|
||||
public function testPatchActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
@@ -285,12 +285,12 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiResponseAccessDenied($response, 'User cannot update customer');
|
||||
}
|
||||
|
||||
public function testPatchActionWithUnknownActivity()
|
||||
public function testPatchActionWithUnknownActivity(): void
|
||||
{
|
||||
$this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/customers/255', []);
|
||||
}
|
||||
|
||||
public function testInvalidPatchAction()
|
||||
public function testInvalidPatchAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -307,19 +307,19 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['currency']);
|
||||
}
|
||||
|
||||
public function testMetaActionNotAllowed()
|
||||
public function testMetaActionNotAllowed(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->request($client, '/api/customers/1/meta', 'PATCH', [], json_encode(['name' => 'asdasd']));
|
||||
$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', []);
|
||||
}
|
||||
|
||||
public function testMetaActionThrowsExceptionOnMissingName()
|
||||
public function testMetaActionThrowsExceptionOnMissingName(): void
|
||||
{
|
||||
$this->assertExceptionForPatchAction(User::ROLE_ADMIN, '/api/customers/1/meta', ['value' => 'X'], [
|
||||
'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'], [
|
||||
'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'], [
|
||||
'code' => 404,
|
||||
@@ -343,7 +343,7 @@ class CustomerControllerTest extends APIControllerBaseTest
|
||||
]);
|
||||
}
|
||||
|
||||
public function testMetaAction()
|
||||
public function testMetaAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new CustomerTestMetaFieldSubscriberMock());
|
||||
|
||||
@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class TimesheetConfigTest extends TestCase
|
||||
{
|
||||
public function testSetter()
|
||||
public function testSetter(): void
|
||||
{
|
||||
$sut = new TimesheetConfig();
|
||||
$sut->setIsAllowFutureTimes(false);
|
||||
|
||||
@@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class NotFoundExceptionTest extends TestCase
|
||||
{
|
||||
public function testConstructor()
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$sut = new NotFoundException();
|
||||
self::assertEquals('Not found', $sut->getMessage());
|
||||
|
||||
@@ -88,12 +88,12 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
return [$rate1, $rate2];
|
||||
}
|
||||
|
||||
public function testIsSecure()
|
||||
public function testIsSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/api/projects');
|
||||
}
|
||||
|
||||
public function testGetCollection()
|
||||
public function testGetCollection(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$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'], []];
|
||||
}
|
||||
|
||||
public function testGetEntity()
|
||||
public function testGetEntity(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$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.');
|
||||
}
|
||||
|
||||
public function testPostAction()
|
||||
public function testPostAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -331,7 +331,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
self::assertFalse($result['visible']);
|
||||
}
|
||||
|
||||
public function testPostActionWithOtherFields()
|
||||
public function testPostActionWithOtherFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -354,7 +354,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
self::assertTrue($result['visible']);
|
||||
}
|
||||
|
||||
public function testPostActionWithOtherFieldsAndFalse()
|
||||
public function testPostActionWithOtherFieldsAndFalse(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -377,7 +377,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
self::assertFalse($result['visible']);
|
||||
}
|
||||
|
||||
public function testPostActionWithOtherFields3()
|
||||
public function testPostActionWithOtherFields3(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -400,7 +400,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
self::assertTrue($result['visible']);
|
||||
}
|
||||
|
||||
public function testPostActionWithLeastFields()
|
||||
public function testPostActionWithLeastFields(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -420,7 +420,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
self::assertFalse($result['visible']);
|
||||
}
|
||||
|
||||
public function testPostActionWithInvalidUser()
|
||||
public function testPostActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$data = [
|
||||
@@ -433,7 +433,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiResponseAccessDenied($response, 'User cannot create projects');
|
||||
}
|
||||
|
||||
public function testPostActionWithInvalidData()
|
||||
public function testPostActionWithInvalidData(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -447,7 +447,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['customer'], true);
|
||||
}
|
||||
|
||||
public function testPatchAction()
|
||||
public function testPatchAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -467,7 +467,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
$this->assertNotEmpty($result['id']);
|
||||
}
|
||||
|
||||
public function testPatchActionWithInvalidUser()
|
||||
public function testPatchActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
@@ -482,12 +482,12 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiResponseAccessDenied($response, 'User cannot update project');
|
||||
}
|
||||
|
||||
public function testPatchActionWithUnknownActivity()
|
||||
public function testPatchActionWithUnknownActivity(): void
|
||||
{
|
||||
$this->assertEntityNotFoundForPatch(User::ROLE_USER, '/api/projects/255', []);
|
||||
}
|
||||
|
||||
public function testInvalidPatchAction()
|
||||
public function testInvalidPatchAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -502,12 +502,12 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
$this->assertApiCallValidationError($response, ['customer']);
|
||||
}
|
||||
|
||||
public function testMetaActionThrowsNotFound()
|
||||
public function testMetaActionThrowsNotFound(): void
|
||||
{
|
||||
$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'], [
|
||||
'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'], [
|
||||
'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'], [
|
||||
'code' => 404,
|
||||
@@ -531,7 +531,7 @@ class ProjectControllerTest extends APIControllerBaseTest
|
||||
]);
|
||||
}
|
||||
|
||||
public function testMetaAction()
|
||||
public function testMetaAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
self::getContainer()->get('event_dispatcher')->addSubscriber(new ProjectTestMetaFieldSubscriberMock());
|
||||
|
||||
@@ -35,7 +35,7 @@ trait RateControllerTestTrait
|
||||
*/
|
||||
abstract protected function importTestRates($id): array;
|
||||
|
||||
public function testAddRateMissingEntityAction()
|
||||
public function testAddRateMissingEntityAction(): void
|
||||
{
|
||||
$data = [
|
||||
'user' => 1,
|
||||
@@ -47,7 +47,7 @@ trait RateControllerTestTrait
|
||||
$this->assertEntityNotFoundForPost($client, $this->getRateUrl(99), $data);
|
||||
}
|
||||
|
||||
public function testAddRateMissingUserAction()
|
||||
public function testAddRateMissingUserAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -63,7 +63,7 @@ trait RateControllerTestTrait
|
||||
$this->assertApiCallValidationError($response, ['user']);
|
||||
}
|
||||
|
||||
public function testAddRateActionWithInvalidUser()
|
||||
public function testAddRateActionWithInvalidUser(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$data = [
|
||||
@@ -77,7 +77,7 @@ trait RateControllerTestTrait
|
||||
$this->assertApiResponseAccessDenied($response, 'Access denied.');
|
||||
}
|
||||
|
||||
public function testAddRateAction()
|
||||
public function testAddRateAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -98,7 +98,7 @@ trait RateControllerTestTrait
|
||||
$this->assertFalse($result['isFixed']);
|
||||
}
|
||||
|
||||
public function testAddFixedRateAction()
|
||||
public function testAddFixedRateAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$data = [
|
||||
@@ -119,7 +119,7 @@ trait RateControllerTestTrait
|
||||
$this->assertTrue($result['isFixed']);
|
||||
}
|
||||
|
||||
public function testGetRatesEmptyResult()
|
||||
public function testGetRatesEmptyResult(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->request($client, $this->getRateUrl(1));
|
||||
@@ -130,7 +130,7 @@ trait RateControllerTestTrait
|
||||
$this->assertEmpty($result);
|
||||
}
|
||||
|
||||
public function testGetRates()
|
||||
public function testGetRates(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$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));
|
||||
}
|
||||
|
||||
public function testGetRatesIsSecured()
|
||||
public function testGetRatesIsSecured(): void
|
||||
{
|
||||
$this->assertUrlIsSecuredForRole(User::ROLE_USER, $this->getRateUrl(1));
|
||||
}
|
||||
|
||||
public function testDeleteRate()
|
||||
public function testDeleteRate(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$expectedRates = $this->importTestRates(1);
|
||||
@@ -176,19 +176,19 @@ trait RateControllerTestTrait
|
||||
$this->assertEquals(\count($expectedRates) - 1, \count($result));
|
||||
}
|
||||
|
||||
public function testDeleteRateEntityNotFound()
|
||||
public function testDeleteRateEntityNotFound(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->assertNotFoundForDelete($client, $this->getRateUrl(99, 1));
|
||||
}
|
||||
|
||||
public function testDeleteRateRateNotFound()
|
||||
public function testDeleteRateRateNotFound(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->assertNotFoundForDelete($client, $this->getRateUrl(1, 99));
|
||||
}
|
||||
|
||||
public function testDeleteRateWithInvalidAssignment()
|
||||
public function testDeleteRateWithInvalidAssignment(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);
|
||||
$this->importTestRates(1);
|
||||
@@ -197,7 +197,7 @@ trait RateControllerTestTrait
|
||||
$this->assertNotFoundForDelete($client, $this->getRateUrl(2, 1));
|
||||
}
|
||||
|
||||
public function testDeleteNotAllowed()
|
||||
public function testDeleteNotAllowed(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$rates = $this->importTestRates(1);
|
||||
@@ -209,7 +209,7 @@ trait RateControllerTestTrait
|
||||
$this->assertApiResponseAccessDenied($client->getResponse(), 'Access denied.');
|
||||
}
|
||||
|
||||
protected function assertRateStructure(array $result, $user = null)
|
||||
public function assertRateStructure(array $result, $user = null): void
|
||||
{
|
||||
$expectedKeys = [
|
||||
'id', 'rate', 'internalRate', 'isFixed', 'user'
|
||||
|
||||
@@ -27,7 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
class ValidationFailedExceptionErrorHandlerTest extends TestCase
|
||||
{
|
||||
public function testSubscribingMethods()
|
||||
public function testSubscribingMethods(): void
|
||||
{
|
||||
self::assertEquals([[
|
||||
'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
|
||||
@@ -44,7 +44,7 @@ class ValidationFailedExceptionErrorHandlerTest extends TestCase
|
||||
]], ValidationFailedExceptionErrorHandler::getSubscribingMethods());
|
||||
}
|
||||
|
||||
public function testWithEmptyConstraintsList()
|
||||
public function testWithEmptyConstraintsList(): void
|
||||
{
|
||||
$security = $this->createMock(Security::class);
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
@@ -64,7 +64,7 @@ class ValidationFailedExceptionErrorHandlerTest extends TestCase
|
||||
self::assertEquals($expected, $sut->serializeValidationExceptionToJson(new JsonSerializationVisitor(), $validations, [], new SerializationContext()));
|
||||
}
|
||||
|
||||
public function testWithUnsupportedException()
|
||||
public function testWithUnsupportedException(): void
|
||||
{
|
||||
$security = $this->createMock(Security::class);
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
@@ -81,7 +81,7 @@ class ValidationFailedExceptionErrorHandlerTest extends TestCase
|
||||
self::assertEquals('foooo', $actual);
|
||||
}
|
||||
|
||||
public function testWithConstraintsList()
|
||||
public function testWithConstraintsList(): void
|
||||
{
|
||||
$security = $this->createMock(Security::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);
|
||||
$translator = $this->createMock(TranslatorInterface::class);
|
||||
|
||||
Reference in New Issue
Block a user