replace PHPUnit annotations with attributes (#5608)
This commit is contained in:
@@ -14,10 +14,9 @@ use App\Tests\DataFixtures\ActivityFixtures;
|
||||
use App\Tests\DataFixtures\CustomerFixtures;
|
||||
use App\Tests\DataFixtures\ProjectFixtures;
|
||||
use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class ActionsControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
public function testIsSecure(): void
|
||||
|
||||
@@ -21,13 +21,13 @@ use App\Repository\ActivityRateRepository;
|
||||
use App\Repository\ActivityRepository;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
use App\Tests\Mocks\ActivityTestMetaFieldSubscriberMock;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class ActivityControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
use RateControllerTestTrait;
|
||||
@@ -140,9 +140,7 @@ class ActivityControllerTest extends APIControllerBaseTestCase
|
||||
return [$project, $project2, $activity1];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getCollectionTestData
|
||||
*/
|
||||
#[DataProvider('getCollectionTestData')]
|
||||
public function testGetCollection($url, $project, $parameters, $expected): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
@@ -11,10 +11,9 @@ namespace App\Tests\API;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Tests\Controller\AbstractControllerBaseTestCase;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class ApiDocControllerTest extends AbstractControllerBaseTestCase
|
||||
{
|
||||
public function testIsSecure(): void
|
||||
|
||||
@@ -13,12 +13,11 @@ use App\API\Authentication\AccessTokenHandler;
|
||||
use App\Entity\AccessToken;
|
||||
use App\Entity\User;
|
||||
use App\Repository\AccessTokenRepository;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Authentication\AccessTokenHandler
|
||||
*/
|
||||
#[CoversClass(AccessTokenHandler::class)]
|
||||
class AccessTokenHandlerTest extends TestCase
|
||||
{
|
||||
private function getSut(?AccessToken $accessToken = null): AccessTokenHandler
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace App\Tests\API\Authentication;
|
||||
use App\API\Authentication\TokenAuthenticator;
|
||||
use App\Entity\User;
|
||||
use App\Repository\ApiUserRepository;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
|
||||
@@ -21,10 +23,8 @@ use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationExc
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CustomCredentials;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Authentication\TokenAuthenticator
|
||||
* @group legacy
|
||||
*/
|
||||
#[CoversClass(TokenAuthenticator::class)]
|
||||
#[Group('legacy')]
|
||||
class TokenAuthenticatorTest extends TestCase
|
||||
{
|
||||
private function getSut(bool $verify = true): TokenAuthenticator
|
||||
|
||||
@@ -11,14 +11,14 @@ namespace App\Tests\API;
|
||||
|
||||
use App\DataFixtures\UserFixtures;
|
||||
use App\Entity\User;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* These tests make sure, that the deprecated API login with X-AUTH-USER and X-AUTH-TOKEN still works.
|
||||
*
|
||||
* @group legacy
|
||||
* @group integration
|
||||
* Make sure that the deprecated API login with X-AUTH-USER and X-AUTH-TOKEN still works.
|
||||
*/
|
||||
#[Group('legacy')]
|
||||
#[Group('integration')]
|
||||
class AuthenticationTest extends APIControllerBaseTestCase
|
||||
{
|
||||
public function testPinIsSecure(): void
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
namespace App\Tests\API;
|
||||
|
||||
use App\Entity\User;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class ConfigurationControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
public function testIsTimesheetSecure(): void
|
||||
|
||||
@@ -21,13 +21,12 @@ use App\Entity\User;
|
||||
use App\Repository\CustomerRateRepository;
|
||||
use App\Repository\CustomerRepository;
|
||||
use App\Tests\Mocks\CustomerTestMetaFieldSubscriberMock;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class CustomerControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
use RateControllerTestTrait;
|
||||
|
||||
@@ -12,12 +12,11 @@ namespace App\Tests\API;
|
||||
use App\Entity\ExportTemplate;
|
||||
use App\Entity\User;
|
||||
use App\Repository\ExportTemplateRepository;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class ExportControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
private function importExportTemplate(): ExportTemplate
|
||||
|
||||
@@ -12,10 +12,9 @@ namespace App\Tests\API;
|
||||
use App\Entity\Invoice;
|
||||
use App\Entity\User;
|
||||
use App\Tests\DataFixtures\InvoiceFixtures;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class InvoiceControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
namespace App\Tests\API\Model;
|
||||
|
||||
use App\API\Model\PageAction;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Model\PageAction
|
||||
*/
|
||||
#[CoversClass(PageAction::class)]
|
||||
class PageActionTest extends TestCase
|
||||
{
|
||||
public function testEmptySettings(): void
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
namespace App\Tests\API\Model;
|
||||
|
||||
use App\API\Model\TimesheetConfig;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Model\TimesheetConfig
|
||||
*/
|
||||
#[CoversClass(TimesheetConfig::class)]
|
||||
class TimesheetConfigTest extends TestCase
|
||||
{
|
||||
public function testSetter(): void
|
||||
|
||||
@@ -11,11 +11,10 @@ namespace App\Tests\API\Model;
|
||||
|
||||
use App\API\Model\Version;
|
||||
use App\Constants;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Model\Version
|
||||
*/
|
||||
#[CoversClass(Version::class)]
|
||||
class VersionTest extends TestCase
|
||||
{
|
||||
public function testValues(): void
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
namespace App\Tests\API;
|
||||
|
||||
use App\API\NotFoundException;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\API\NotFoundException
|
||||
*/
|
||||
#[CoversClass(NotFoundException::class)]
|
||||
class NotFoundExceptionTest extends TestCase
|
||||
{
|
||||
public function testConstructor(): void
|
||||
|
||||
@@ -21,13 +21,13 @@ use App\Repository\ProjectRateRepository;
|
||||
use App\Repository\ProjectRepository;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
use App\Tests\Mocks\ProjectTestMetaFieldSubscriberMock;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class ProjectControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
use RateControllerTestTrait;
|
||||
@@ -191,9 +191,7 @@ class ProjectControllerTest extends APIControllerBaseTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getCollectionTestData
|
||||
*/
|
||||
#[DataProvider('getCollectionTestData')]
|
||||
public function testGetCollectionWithParams(string $url, ?int $project, array $parameters, array $expected): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
@@ -15,6 +15,7 @@ use FOS\RestBundle\Serializer\Normalizer\FlattenExceptionHandler;
|
||||
use JMS\Serializer\GraphNavigatorInterface;
|
||||
use JMS\Serializer\JsonSerializationVisitor;
|
||||
use JMS\Serializer\SerializationContext;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\ErrorHandler\Exception\FlattenException;
|
||||
@@ -22,9 +23,7 @@ use Symfony\Component\Validator\ConstraintViolation;
|
||||
use Symfony\Component\Validator\ConstraintViolationList;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Serializer\ValidationFailedExceptionErrorHandler
|
||||
*/
|
||||
#[CoversClass(ValidationFailedExceptionErrorHandler::class)]
|
||||
class ValidationFailedExceptionErrorHandlerTest extends TestCase
|
||||
{
|
||||
public function testSubscribingMethods(): void
|
||||
|
||||
@@ -11,10 +11,9 @@ namespace App\Tests\API;
|
||||
|
||||
use App\Constants;
|
||||
use App\Entity\User;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class StatusControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
public function testIsSecurePing(): void
|
||||
|
||||
@@ -12,11 +12,10 @@ namespace App\Tests\API;
|
||||
use App\Entity\Tag;
|
||||
use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TagFixtures;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class TagControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -13,11 +13,11 @@ use App\Entity\Team;
|
||||
use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TeamFixtures;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class TeamControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
/**
|
||||
@@ -47,9 +47,7 @@ class TeamControllerTest extends APIControllerBaseTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getRoleTestData
|
||||
*/
|
||||
#[DataProvider('getRoleTestData')]
|
||||
public function testIsSecureForRole(string $role): void
|
||||
{
|
||||
$this->assertUrlIsSecuredForRole($role, '/api/teams');
|
||||
|
||||
@@ -20,12 +20,12 @@ use App\Entity\User;
|
||||
use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
use App\Tests\Mocks\TimesheetTestMetaFieldSubscriberMock;
|
||||
use App\Timesheet\DateTimeFactory;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class TimesheetControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
public const DATE_FORMAT = 'Y-m-d H:i:s';
|
||||
@@ -779,9 +779,7 @@ class TimesheetControllerTest extends APIControllerBaseTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getTrackingModeTestData
|
||||
*/
|
||||
#[DataProvider('getTrackingModeTestData')]
|
||||
public function testCreateActionWithTrackingModeHasFieldsForUser(string $trackingMode, string $user, bool $showTimes): void
|
||||
{
|
||||
$dateTime = new DateTimeFactory(new \DateTimeZone(self::TEST_TIMEZONE));
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
namespace App\Tests\API;
|
||||
|
||||
use App\Entity\User;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
#[Group('integration')]
|
||||
class UserControllerTest extends APIControllerBaseTestCase
|
||||
{
|
||||
public function testIsSecure(): void
|
||||
@@ -33,9 +33,7 @@ class UserControllerTest extends APIControllerBaseTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getRoleTestData
|
||||
*/
|
||||
#[DataProvider('getRoleTestData')]
|
||||
public function testIsSecureForRole(string $role): void
|
||||
{
|
||||
$this->assertUrlIsSecuredForRole($role, '/api/users');
|
||||
|
||||
Reference in New Issue
Block a user