Skip to content

Commit

Permalink
Added #[Override] attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
tarlepp committed Oct 20, 2024
1 parent 9a987f9 commit 70dacd3
Show file tree
Hide file tree
Showing 34 changed files with 96 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* After that enable this directory and run rector again
* and do that whole process again.
*/
//__DIR__ . '/tests',
__DIR__ . '/tests',
]);

// Enable single or multiple rules with rector
Expand Down
2 changes: 2 additions & 0 deletions tests/E2E/Controller/v1/Auth/LoginFailureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Resource\LogLoginFailureResource;
use App\Tests\Utils\PhpUnitUtil;
use App\Utils\JSON;
use Override;
use PHPUnit\Framework\Attributes\TestDox;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
Expand All @@ -27,6 +28,7 @@ class LoginFailureTest extends WebTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Tests\Utils\PhpUnitUtil;
use App\Utils\JSON;
use Generator;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use Throwable;
Expand All @@ -30,6 +31,7 @@ class AttachUserGroupControllerTest extends WebTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
2 changes: 2 additions & 0 deletions tests/E2E/Controller/v1/User/DeleteUserControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use App\Tests\E2E\TestCase\WebTestCase;
use App\Tests\Utils\PhpUnitUtil;
use Generator;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use Throwable;
Expand All @@ -28,6 +29,7 @@ class DeleteUserControllerTest extends WebTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Tests\E2E\TestCase\WebTestCase;
use App\Tests\Utils\PhpUnitUtil;
use Generator;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use Throwable;
Expand All @@ -29,6 +30,7 @@ class DetachUserGroupControllerTest extends WebTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Tests\Utils\PhpUnitUtil;
use App\Utils\JSON;
use Generator;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use Throwable;
Expand All @@ -30,6 +31,7 @@ class AttachUserControllerTest extends WebTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Tests\E2E\TestCase\WebTestCase;
use App\Tests\Utils\PhpUnitUtil;
use Generator;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use Throwable;
Expand All @@ -29,6 +30,7 @@ class DetachUserControllerTest extends WebTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
3 changes: 3 additions & 0 deletions tests/E2E/Rest/Traits/Actions/AdminActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Tests\E2E\TestCase\RestTraitTestCase;
use Generator;
use Override;
use function getenv;

/**
Expand All @@ -20,6 +21,7 @@ class AdminActionsTest extends RestTraitTestCase
{
protected static string $route = '/test_admin_actions';

#[Override]
public static function getValidUsers(): Generator
{
yield ['john-admin', 'password-admin'];
Expand All @@ -35,6 +37,7 @@ public static function getValidUsers(): Generator
}
}

#[Override]
public static function getInvalidUsers(): Generator
{
if (getenv('USE_ALL_USER_COMBINATIONS') === 'yes') {
Expand Down
7 changes: 7 additions & 0 deletions tests/E2E/Rest/Traits/Actions/AnonActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Tests\E2E\TestCase\RestTraitTestCase;
use Generator;
use Override;
use function getenv;

/**
Expand All @@ -23,6 +24,7 @@ class AnonActionsTest extends RestTraitTestCase
/**
* @noinspection PhpMissingParentCallCommonInspection
*/
#[Override]
public function testThatCountRouteDoesNotAllowInvalidUser(
?string $u = null,
?string $p = null,
Expand All @@ -34,6 +36,7 @@ public function testThatCountRouteDoesNotAllowInvalidUser(
/**
* @noinspection PhpMissingParentCallCommonInspection
*/
#[Override]
public function testThatRootRouteDoesNotAllowInvalidUser(
?string $u = null,
?string $p = null,
Expand All @@ -45,6 +48,7 @@ public function testThatRootRouteDoesNotAllowInvalidUser(
/**
* @noinspection PhpMissingParentCallCommonInspection
*/
#[Override]
public function testThatUuidRouteWithIdDoesNotAllowInvalidUser(
string $uuid = '',
?string $u = null,
Expand All @@ -57,6 +61,7 @@ public function testThatUuidRouteWithIdDoesNotAllowInvalidUser(
/**
* @noinspection PhpMissingParentCallCommonInspection
*/
#[Override]
public function testThatIdsRouteDoesNotAllowInvalidUser(
?string $u = null,
?string $p = null,
Expand All @@ -65,6 +70,7 @@ public function testThatIdsRouteDoesNotAllowInvalidUser(
static::markTestSkipped('There isn\'t invalid users, so cannot test this.');
}

#[Override]
public static function getValidUsers(): Generator
{
yield [null, null];
Expand All @@ -88,6 +94,7 @@ public static function getValidUsers(): Generator
/**
* @psalm-suppress InvalidReturnType
*/
#[Override]
public static function getInvalidUsers(): Generator
{
yield from [];
Expand Down
3 changes: 3 additions & 0 deletions tests/E2E/Rest/Traits/Actions/AuthenticatedActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Tests\E2E\TestCase\RestTraitTestCase;
use Generator;
use Override;
use function getenv;

/**
Expand All @@ -20,6 +21,7 @@ class AuthenticatedActionsTest extends RestTraitTestCase
{
protected static string $route = '/test_authenticated_actions';

#[Override]
public static function getValidUsers(): Generator
{
yield ['john', 'password'];
Expand All @@ -43,6 +45,7 @@ public static function getValidUsers(): Generator
}
}

#[Override]
public static function getInvalidUsers(): Generator
{
yield [null, null];
Expand Down
3 changes: 3 additions & 0 deletions tests/E2E/Rest/Traits/Actions/LoggedActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Tests\E2E\TestCase\RestTraitTestCase;
use Generator;
use Override;
use function getenv;

/**
Expand All @@ -20,6 +21,7 @@ class LoggedActionsTest extends RestTraitTestCase
{
protected static string $route = '/test_logged_actions';

#[Override]
public static function getValidUsers(): Generator
{
yield ['john-logged', 'password-logged'];
Expand All @@ -41,6 +43,7 @@ public static function getValidUsers(): Generator
}
}

#[Override]
public static function getInvalidUsers(): Generator
{
yield [null, null];
Expand Down
3 changes: 3 additions & 0 deletions tests/E2E/Rest/Traits/Actions/RootActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Tests\E2E\TestCase\RestTraitTestCase;
use Generator;
use Override;
use function getenv;

/**
Expand All @@ -20,12 +21,14 @@ class RootActionsTest extends RestTraitTestCase
{
protected static string $route = '/test_root_actions';

#[Override]
public static function getValidUsers(): Generator
{
yield ['john-root', 'password-root'];
yield ['john.doe-root@test.com', 'password-root'];
}

#[Override]
public static function getInvalidUsers(): Generator
{
if (getenv('USE_ALL_USER_COMBINATIONS') === 'yes') {
Expand Down
3 changes: 3 additions & 0 deletions tests/E2E/Rest/Traits/Actions/UserActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Tests\E2E\TestCase\RestTraitTestCase;
use Generator;
use Override;
use function getenv;

/**
Expand All @@ -20,6 +21,7 @@ class UserActionsTest extends RestTraitTestCase
{
protected static string $route = '/test_user_actions';

#[Override]
public static function getValidUsers(): Generator
{
yield ['john-user', 'password-user'];
Expand All @@ -37,6 +39,7 @@ public static function getValidUsers(): Generator
}
}

#[Override]
public static function getInvalidUsers(): Generator
{
yield [null, null];
Expand Down
2 changes: 2 additions & 0 deletions tests/E2E/Rest/src/Resource/ResourceForLifeCycleTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Entity\Role as Entity;
use App\Repository\RoleRepository as Repository;
use App\Rest\RestResource;
use Override;
use Symfony\Component\HttpKernel\Exception\HttpException;

/**
Expand Down Expand Up @@ -43,6 +44,7 @@ public function __construct(
parent::__construct($repository);
}

#[Override]
public function afterFindOne(string &$id, ?EntityInterface $entity = null): void
{
parent::afterFindOne($id, $entity);
Expand Down
2 changes: 2 additions & 0 deletions tests/E2E/TestCase/RestTraitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Tests\Utils\PhpUnitUtil;
use Generator;
use Override;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -33,6 +34,7 @@ abstract class RestTraitTestCase extends WebTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
3 changes: 3 additions & 0 deletions tests/E2E/TestCase/WebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace App\Tests\E2E\TestCase;

use Override;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Throwable;
Expand All @@ -25,6 +26,7 @@ abstract class WebTestCase extends BaseWebTestCase
/**
* @codeCoverageIgnore
*/
#[Override]
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
Expand All @@ -35,6 +37,7 @@ public static function setUpBeforeClass(): void
/**
* @codeCoverageIgnore
*/
#[Override]
public static function tearDownAfterClass(): void
{
parent::tearDownAfterClass();
Expand Down
2 changes: 2 additions & 0 deletions tests/Functional/Repository/HealthzRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use App\Tests\Utils\PhpUnitUtil;
use DateTimeImmutable;
use DateTimeZone;
use Override;
use PHPUnit\Framework\Attributes\Depends;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Throwable;
Expand All @@ -25,6 +26,7 @@ class HealthzRepositoryTest extends KernelTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
2 changes: 2 additions & 0 deletions tests/Functional/Repository/RoleRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Repository\RoleRepository;
use App\Tests\Utils\PhpUnitUtil;
use Override;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Throwable;

Expand All @@ -22,6 +23,7 @@ class RoleRepositoryTest extends KernelTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
2 changes: 2 additions & 0 deletions tests/Functional/Repository/UserRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Entity\User;
use App\Repository\UserRepository;
use App\Tests\Utils\PhpUnitUtil;
use Override;
use PHPUnit\Framework\Attributes\Depends;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Throwable;
Expand All @@ -27,6 +28,7 @@ class UserRepositoryTest extends KernelTestCase
/**
* @throws Throwable
*/
#[Override]
public static function tearDownAfterClass(): void
{
self::bootKernel();
Expand Down
Loading

0 comments on commit 70dacd3

Please sign in to comment.