mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-29 22:30:01 +02:00
Migrated phpunit annotations to attributes
This commit is contained in:
parent
f1d34bbc24
commit
dc480f755c
50 changed files with 171 additions and 246 deletions
|
@ -22,13 +22,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
abstract class AbstractAdminControllerTest extends WebTestCase
|
||||
{
|
||||
protected static string $base_path = 'not_valid';
|
||||
|
@ -43,10 +43,10 @@ abstract class AbstractAdminControllerTest extends WebTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @dataProvider readDataProvider
|
||||
* @group slow
|
||||
* Tests if you can access the /new part which is used to list all entities. Checks if permissions are working
|
||||
*/
|
||||
#[DataProvider('readDataProvider')]
|
||||
#[Group('slow')]
|
||||
public function testListEntries(string $user, bool $read): void
|
||||
{
|
||||
static::ensureKernelShutdown();
|
||||
|
@ -72,10 +72,13 @@ abstract class AbstractAdminControllerTest extends WebTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @dataProvider readDataProvider
|
||||
* @group slow
|
||||
* Tests if it is possible to access a specific entity. Checks if permissions are working.
|
||||
* @param string $user
|
||||
* @param bool $read
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('readDataProvider')]
|
||||
#[Group('slow')]
|
||||
public function testReadEntity(string $user, bool $read): void
|
||||
{
|
||||
//Test read access
|
||||
|
@ -106,10 +109,9 @@ abstract class AbstractAdminControllerTest extends WebTestCase
|
|||
|
||||
/**
|
||||
* Tests if deleting an entity is working.
|
||||
*
|
||||
* @group slow
|
||||
* @dataProvider deleteDataProvider
|
||||
*/
|
||||
#[DataProvider('deleteDataProvider')]
|
||||
#[Group('slow')]
|
||||
public function testDeleteEntity(string $user, bool $delete): void
|
||||
{
|
||||
//Test read access
|
||||
|
|
|
@ -22,12 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class AttachmentTypeControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/attachment_type';
|
||||
|
|
|
@ -22,12 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\Parts\Category;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class CategoryControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/category';
|
||||
|
|
|
@ -22,12 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class FootprintControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/footprint';
|
||||
|
|
|
@ -41,6 +41,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||
|
||||
|
@ -51,10 +53,9 @@ class LabelProfileControllerTest extends AbstractAdminControllerTest
|
|||
|
||||
/**
|
||||
* Tests if deleting an entity is working.
|
||||
*
|
||||
* @group slow
|
||||
* @dataProvider deleteDataProvider
|
||||
*/
|
||||
#[DataProvider('deleteDataProvider')]
|
||||
#[Group('slow')]
|
||||
public function testDeleteEntity(string $user, bool $delete): void
|
||||
{
|
||||
//Test read access
|
||||
|
|
|
@ -22,12 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class ManufacturerControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/manufacturer';
|
||||
|
|
|
@ -22,12 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class MeasurementUnitControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/measurement_unit';
|
||||
|
|
|
@ -23,12 +23,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class ProjectControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/project';
|
||||
|
|
|
@ -22,12 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class StorelocationControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/store_location';
|
||||
|
|
|
@ -22,12 +22,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Controller\AdminPages;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use App\Entity\Parts\Supplier;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
* @group DB
|
||||
*/
|
||||
#[Group('slow')]
|
||||
#[Group('DB')]
|
||||
class SupplierControllerTest extends AbstractAdminControllerTest
|
||||
{
|
||||
protected static string $base_path = '/en/supplier';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue