Fixed some more inspection issues

This commit is contained in:
Jan Böhmer 2023-04-15 22:05:29 +02:00
parent de96aae9a5
commit 29d1d49aca
83 changed files with 153 additions and 172 deletions

View file

@ -31,8 +31,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
*/
abstract class AbstractAdminControllerTest extends WebTestCase
{
protected static $base_path = 'not_valid';
protected static $entity_class = 'not valid';
protected static string $base_path = 'not_valid';
protected static string $entity_class = 'not valid';
public function readDataProvider(): array
{

View file

@ -30,6 +30,6 @@ use App\Entity\Attachments\AttachmentType;
*/
class AttachmentTypeControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/attachment_type';
protected static $entity_class = AttachmentType::class;
protected static string $base_path = '/en'.'/attachment_type';
protected static string $entity_class = AttachmentType::class;
}

View file

@ -30,6 +30,6 @@ use App\Entity\Parts\Category;
*/
class CategoryControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/category';
protected static $entity_class = Category::class;
protected static string $base_path = '/en'.'/category';
protected static string $entity_class = Category::class;
}

View file

@ -30,6 +30,6 @@ use App\Entity\Parts\Footprint;
*/
class FootprintControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/footprint';
protected static $entity_class = Footprint::class;
protected static string $base_path = '/en'.'/footprint';
protected static string $entity_class = Footprint::class;
}

View file

@ -46,8 +46,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class LabelProfileControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/label_profile';
protected static $entity_class = LabelProfile::class;
protected static string $base_path = '/en'.'/label_profile';
protected static string $entity_class = LabelProfile::class;
/**
* Tests if deleting an entity is working.

View file

@ -30,6 +30,6 @@ use App\Entity\Parts\Manufacturer;
*/
class ManufacturerControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/manufacturer';
protected static $entity_class = Manufacturer::class;
protected static string $base_path = '/en'.'/manufacturer';
protected static string $entity_class = Manufacturer::class;
}

View file

@ -30,6 +30,6 @@ use App\Entity\Parts\MeasurementUnit;
*/
class MeasurementUnitControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/measurement_unit';
protected static $entity_class = MeasurementUnit::class;
protected static string $base_path = '/en'.'/measurement_unit';
protected static string $entity_class = MeasurementUnit::class;
}

View file

@ -31,6 +31,6 @@ use App\Entity\ProjectSystem\Project;
*/
class ProjectControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/project';
protected static $entity_class = Project::class;
protected static string $base_path = '/en'.'/project';
protected static string $entity_class = Project::class;
}

View file

@ -30,6 +30,6 @@ use App\Entity\Parts\Storelocation;
*/
class StorelocationControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/store_location';
protected static $entity_class = Storelocation::class;
protected static string $base_path = '/en'.'/store_location';
protected static string $entity_class = Storelocation::class;
}

View file

@ -30,6 +30,6 @@ use App\Entity\Parts\Supplier;
*/
class SupplierControllerTest extends AbstractAdminControllerTest
{
protected static $base_path = '/en'.'/supplier';
protected static $entity_class = Supplier::class;
protected static string $base_path = '/en'.'/supplier';
protected static string $entity_class = Supplier::class;
}

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Tests\Controller;
use App\Entity\UserSystem\User;
use App\Repository\UserRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@ -32,9 +33,9 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
class RedirectControllerTest extends WebTestCase
{
protected $em;
protected $userRepo;
protected $client;
protected EntityManagerInterface $em;
protected UserRepository $userRepo;
protected \Symfony\Bundle\FrameworkBundle\KernelBrowser $client;
protected function setUp(): void
{

View file

@ -282,7 +282,7 @@ class AttachmentTest extends TestCase
* @param string $property - property on instance being modified
* @param mixed $value - new value of the property being modified
*/
public function setProtectedProperty($object, $property, $value): void
public function setProtectedProperty(object $object, string $property, $value): void
{
$reflection = new ReflectionClass($object);
$reflection_property = $reflection->getProperty($property);

View file

@ -33,12 +33,12 @@ use PHPUnit\Framework\TestCase;
*/
class AbstractStructuralDBElementTest extends TestCase
{
protected $root;
protected $child1;
protected $child2;
protected $child3;
protected $child1_1;
protected $child1_2;
protected AttachmentType $root;
protected AttachmentType $child1;
protected AttachmentType $child2;
protected AttachmentType $child3;
protected AttachmentType $child1_1;
protected AttachmentType $child1_2;
protected function setUp(): void
{

View file

@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase;
class BBCodeToMarkdownConverterTest extends TestCase
{
protected $converter;
protected BBCodeToMarkdownConverter $converter;
protected function setUp(): void
{

View file

@ -35,24 +35,24 @@ class ProjectBuildRequestTest extends TestCase
private MeasurementUnit $float_unit;
/** @var Project */
private $project1;
private Project $project1;
/** @var ProjectBOMEntry */
private $bom_entry1a;
private ProjectBOMEntry $bom_entry1a;
/** @var ProjectBOMEntry */
private $bom_entry1b;
private ProjectBOMEntry $bom_entry1b;
/** @var ProjectBOMEntry */
private $bom_entry1c;
private ProjectBOMEntry $bom_entry1c;
/** @var PartLot $lot1a */
private $lot1a;
/** @var PartLot $lot1b */
private $lot1b;
private $lot2;
private PartLot $lot2;
/** @var Part */
private $part1;
private Part $part1;
/** @var Part */
private $part2;
private Part $part2;
public function setUp(): void

View file

@ -30,11 +30,11 @@ class TreeViewNodeTest extends TestCase
/**
* @var TreeViewNode
*/
protected $node1;
protected TreeViewNode $node1;
/**
* @var TreeViewNode
*/
protected $node2;
protected TreeViewNode $node2;
protected function setUp(): void
{

View file

@ -29,8 +29,8 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class AttachmentPathResolverTest extends WebTestCase
{
protected $media_path;
protected $footprint_path;
protected string $media_path;
protected string $footprint_path;
protected $projectDir_orig;
protected $projectDir;
/**

View file

@ -27,7 +27,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class BuiltinAttachmentsFinderTest extends WebTestCase
{
protected static $mock_list = [
protected static array $mock_list = [
'%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS%/123.jpg', '%FOOTPRINTS%/123.jpeg',
'%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt',
];

View file

@ -51,12 +51,12 @@ class LabelTextReplacerTest extends WebTestCase
/**
* @var LabelTextReplacer
*/
protected $service;
protected LabelTextReplacer $service;
/**
* @var Part
*/
protected $target;
protected Part $target;
protected function setUp(): void
{

View file

@ -53,9 +53,9 @@ class PartLotProviderTest extends WebTestCase
/**
* @var PartLotProvider
*/
protected $service;
protected PartLotProvider $service;
protected $target;
protected PartLot $target;
protected function setUp(): void
{

View file

@ -56,9 +56,9 @@ class PartProviderTest extends WebTestCase
/**
* @var PartProvider
*/
protected $service;
protected PartProvider $service;
protected $target;
protected Part $target;
/**
* @var \Doctrine\ORM\EntityManager

View file

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace App\Tests\Services\Misc;
use App\Services\Misc\FAIconGenerator;
use App\Tests\Services\AmountFormatter;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class FAIconGeneratorTest extends WebTestCase

View file

@ -27,24 +27,24 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
protected $service;
/** @var Part */
private $part;
private Part $part;
/** @var Storelocation */
private $storageLocation;
private Storelocation $storageLocation;
/** @var Storelocation */
private $full_storageLocation;
private Storelocation $full_storageLocation;
/** @var PartLot */
private $partLot1;
private PartLot $partLot1;
/** @var PartLot */
private $partLot2;
private PartLot $partLot2;
/** @var PartLot */
private $partLot3;
private PartLot $partLot3;
/** @var PartLot */
private $fullLot;
private PartLot $fullLot;
/** @var PartLot */
private $lotWithUnknownInstock;
private PartLot $lotWithUnknownInstock;
protected function setUp(): void
{

View file

@ -24,7 +24,6 @@ namespace App\Tests\Services\UserSystem;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\PermissionData;
use App\Entity\UserSystem\PermissionsEmbed;
use App\Entity\UserSystem\User;
use App\Services\UserSystem\PermissionManager;
use InvalidArgumentException;