mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed some return type deprecation messages
This commit is contained in:
parent
558440168d
commit
1cee1abe00
37 changed files with 70 additions and 70 deletions
|
@ -69,7 +69,7 @@ class ImportPartKeeprCommand extends Command
|
||||||
$this->addOption('--import-users', null, InputOption::VALUE_NONE, 'Import users (passwords will not be imported).');
|
$this->addOption('--import-users', null, InputOption::VALUE_NONE, 'Import users (passwords will not be imported).');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ProjectController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/info", name="project_info", requirements={"id"="\d+"})
|
* @Route("/{id}/info", name="project_info", requirements={"id"="\d+"})
|
||||||
*/
|
*/
|
||||||
public function info(Project $project, Request $request, ProjectBuildHelper $buildHelper)
|
public function info(Project $project, Request $request, ProjectBuildHelper $buildHelper): Response
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('read', $project);
|
$this->denyAccessUnlessGranted('read', $project);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ use Omines\DataTablesBundle\Adapter\Doctrine\FetchJoinORMAdapter;
|
||||||
*/
|
*/
|
||||||
class CustomFetchJoinORMAdapter extends FetchJoinORMAdapter
|
class CustomFetchJoinORMAdapter extends FetchJoinORMAdapter
|
||||||
{
|
{
|
||||||
public function getCount(QueryBuilder $queryBuilder, $identifier)
|
public function getCount(QueryBuilder $queryBuilder, $identifier): ?int
|
||||||
{
|
{
|
||||||
$qb_without_group_by = clone $queryBuilder;
|
$qb_without_group_by = clone $queryBuilder;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PrettyBoolColumn extends AbstractColumn
|
||||||
return (bool) $value;
|
return (bool) $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render($value, $context)
|
public function render($value, $context): string
|
||||||
{
|
{
|
||||||
if ($value === true) {
|
if ($value === true) {
|
||||||
return '<span class="badge bg-success"><i class="fa-solid fa-circle-check fa-fw"></i> '
|
return '<span class="badge bg-success"><i class="fa-solid fa-circle-check fa-fw"></i> '
|
||||||
|
|
|
@ -27,7 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
class RowClassColumn extends AbstractColumn
|
class RowClassColumn extends AbstractColumn
|
||||||
{
|
{
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver): self
|
||||||
{
|
{
|
||||||
parent::configureOptions($resolver);
|
parent::configureOptions($resolver);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class SIUnitNumberColumn extends AbstractColumn
|
||||||
$this->formatter = $formatter;
|
$this->formatter = $formatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver): self
|
||||||
{
|
{
|
||||||
parent::configureOptions($resolver);
|
parent::configureOptions($resolver);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
*/
|
*/
|
||||||
class SelectColumn extends AbstractColumn
|
class SelectColumn extends AbstractColumn
|
||||||
{
|
{
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver): self
|
||||||
{
|
{
|
||||||
parent::configureOptions($resolver);
|
parent::configureOptions($resolver);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class SelectColumn extends AbstractColumn
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render($value, $context)
|
public function render($value, $context): string
|
||||||
{
|
{
|
||||||
//Return empty string, as it this column is filled by datatables on client side
|
//Return empty string, as it this column is filled by datatables on client side
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -49,7 +49,7 @@ class SQLiteRegexExtension implements EventSubscriberInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubscribedEvents()
|
public function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return[
|
return[
|
||||||
Events::postConnect
|
Events::postConnect
|
||||||
|
|
|
@ -29,17 +29,17 @@ use Doctrine\DBAL\Types\Type;
|
||||||
class TinyIntType extends Type
|
class TinyIntType extends Type
|
||||||
{
|
{
|
||||||
|
|
||||||
public function getSQLDeclaration(array $column, AbstractPlatform $platform)
|
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
|
||||||
{
|
{
|
||||||
return 'TINYINT';
|
return 'TINYINT';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return 'tinyint';
|
return 'tinyint';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function requiresSQLCommentHint(AbstractPlatform $platform)
|
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
|
||||||
{
|
{
|
||||||
//We use the comment, so that doctrine migrations can properly detect, that nothing has changed and no migration is needed.
|
//We use the comment, so that doctrine migrations can properly detect, that nothing has changed and no migration is needed.
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -41,7 +41,7 @@ class InstanceOfConstraintType extends AbstractType
|
||||||
$resolver->setDefault('data_class', InstanceOfConstraint::class);
|
$resolver->setDefault('data_class', InstanceOfConstraint::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParent()
|
public function getParent(): string
|
||||||
{
|
{
|
||||||
return ChoiceConstraintType::class;
|
return ChoiceConstraintType::class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
class ProjectBOMEntryCollectionType extends AbstractType
|
class ProjectBOMEntryCollectionType extends AbstractType
|
||||||
{
|
{
|
||||||
public function getParent()
|
public function getParent(): string
|
||||||
{
|
{
|
||||||
return CollectionType::class;
|
return CollectionType::class;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ class ProjectBOMEntryCollectionType extends AbstractType
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockPrefix()
|
public function getBlockPrefix(): string
|
||||||
{
|
{
|
||||||
return 'project_bom_entry_collection';
|
return 'project_bom_entry_collection';
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ class ProjectBOMEntryType extends AbstractType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getBlockPrefix()
|
public function getBlockPrefix(): string
|
||||||
{
|
{
|
||||||
return 'project_bom_entry';
|
return 'project_bom_entry';
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
class PartLotSelectType extends AbstractType
|
class PartLotSelectType extends AbstractType
|
||||||
{
|
{
|
||||||
public function getParent()
|
public function getParent(): string
|
||||||
{
|
{
|
||||||
return EntityType::class;
|
return EntityType::class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ class PartSelectType extends AbstractType implements DataMapperInterface
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockPrefix()
|
public function getBlockPrefix(): string
|
||||||
{
|
{
|
||||||
return 'part_select';
|
return 'part_select';
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class ThemeChoiceType extends AbstractType
|
||||||
$this->available_themes = $available_themes;
|
$this->available_themes = $available_themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParent()
|
public function getParent(): string
|
||||||
{
|
{
|
||||||
return ChoiceType::class;
|
return ChoiceType::class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class UserSelectType extends AbstractType
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParent()
|
public function getParent(): string
|
||||||
{
|
{
|
||||||
return StructuralEntityType::class;
|
return StructuralEntityType::class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
AuthenticationSuccessEvent::class => 'onAuthenticationSuccess',
|
AuthenticationSuccessEvent::class => 'onAuthenticationSuccess',
|
||||||
|
|
|
@ -118,7 +118,7 @@ class ParameterVoter extends ExtendedVoter
|
||||||
return $this->resolver->inherit($user, $param, $attribute) ?? false;
|
return $this->resolver->inherit($user, $param, $attribute) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function supports(string $attribute, $subject)
|
protected function supports(string $attribute, $subject): bool
|
||||||
{
|
{
|
||||||
if (is_a($subject, AbstractParameter::class, true)) {
|
if (is_a($subject, AbstractParameter::class, true)) {
|
||||||
//These are the allowed attributes
|
//These are the allowed attributes
|
||||||
|
|
|
@ -43,7 +43,7 @@ class StructuralElementDenormalizer implements ContextAwareDenormalizerInterface
|
||||||
$this->entityManager = $entityManager;
|
$this->entityManager = $entityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supportsDenormalization($data, string $type, string $format = null, array $context = [])
|
public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
|
||||||
{
|
{
|
||||||
return is_array($data)
|
return is_array($data)
|
||||||
&& is_subclass_of($type, AbstractStructuralDBElement::class)
|
&& is_subclass_of($type, AbstractStructuralDBElement::class)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface, Ca
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supportsDenormalization($data, string $type, string $format = null)
|
public function supportsDenormalization($data, string $type, string $format = null): bool
|
||||||
{
|
{
|
||||||
return is_string($data) && is_subclass_of($type, AbstractStructuralDBElement::class);
|
return is_string($data) && is_subclass_of($type, AbstractStructuralDBElement::class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ final class MiscExtension extends AbstractExtension
|
||||||
$this->eventCommentNeededHelper = $eventCommentNeededHelper;
|
$this->eventCommentNeededHelper = $eventCommentNeededHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFunctions()
|
public function getFunctions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new \Twig\TwigFunction('event_comment_needed',
|
new \Twig\TwigFunction('event_comment_needed',
|
||||||
|
|
|
@ -54,7 +54,7 @@ final class TwigCoreExtension extends AbstractExtension
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilters()
|
public function getFilters(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
/* Converts the given object to an array representation of the public/accessible properties */
|
/* Converts the given object to an array representation of the public/accessible properties */
|
||||||
|
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
class PermissionDataTest extends TestCase
|
class PermissionDataTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testGetSetIs()
|
public function testGetSetIs(): void
|
||||||
{
|
{
|
||||||
$perm_data = new PermissionData();
|
$perm_data = new PermissionData();
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class PermissionDataTest extends TestCase
|
||||||
$this->assertFalse($perm_data->isPermissionSet('p1', 'op1'));
|
$this->assertFalse($perm_data->isPermissionSet('p1', 'op1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testJSONSerialization()
|
public function testJSONSerialization(): void
|
||||||
{
|
{
|
||||||
$perm_data = new PermissionData();
|
$perm_data = new PermissionData();
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class PermissionDataTest extends TestCase
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFromJSON()
|
public function testFromJSON(): void
|
||||||
{
|
{
|
||||||
$json = json_encode([
|
$json = json_encode([
|
||||||
'perm1' => [
|
'perm1' => [
|
||||||
|
@ -120,7 +120,7 @@ class PermissionDataTest extends TestCase
|
||||||
$this->assertFalse($perm_data->getPermissionValue('perm2', 'op2'));
|
$this->assertFalse($perm_data->getPermissionValue('perm2', 'op2'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testResetPermissions()
|
public function testResetPermissions(): void
|
||||||
{
|
{
|
||||||
$data = new PermissionData();
|
$data = new PermissionData();
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class PermissionDataTest extends TestCase
|
||||||
$this->assertFalse($data->isPermissionSet('perm1', 'op3'));
|
$this->assertFalse($data->isPermissionSet('perm1', 'op3'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSchemaVersion()
|
public function testGetSchemaVersion(): void
|
||||||
{
|
{
|
||||||
$data = new PermissionData();
|
$data = new PermissionData();
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class PermissionDataTest extends TestCase
|
||||||
$this->assertEquals(12345, $data->getSchemaVersion());
|
$this->assertEquals(12345, $data->getSchemaVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsAnyOperationOfPermissionSet()
|
public function testIsAnyOperationOfPermissionSet(): void
|
||||||
{
|
{
|
||||||
$data = new PermissionData();
|
$data = new PermissionData();
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class PermissionDataTest extends TestCase
|
||||||
$this->assertTrue($data->isAnyOperationOfPermissionSet('perm1'));
|
$this->assertTrue($data->isAnyOperationOfPermissionSet('perm1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAllDefinedOperationsOfPermission()
|
public function testGetAllDefinedOperationsOfPermission(): void
|
||||||
{
|
{
|
||||||
$data = new PermissionData();
|
$data = new PermissionData();
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ class PermissionDataTest extends TestCase
|
||||||
$data->getAllDefinedOperationsOfPermission('perm1'));
|
$data->getAllDefinedOperationsOfPermission('perm1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetAllOperationsOfPermission()
|
public function testSetAllOperationsOfPermission(): void
|
||||||
{
|
{
|
||||||
$data = new PermissionData();
|
$data = new PermissionData();
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class PermissionDataTest extends TestCase
|
||||||
$data->getAllDefinedOperationsOfPermission('perm1'));
|
$data->getAllDefinedOperationsOfPermission('perm1'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRemovePermission()
|
public function testRemovePermission(): void
|
||||||
{
|
{
|
||||||
$data = new PermissionData();
|
$data = new PermissionData();
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ class ProjectBuildRequestTest extends TestCase
|
||||||
$this->project1->addBomEntry($this->bom_entry1c);
|
$this->project1->addBomEntry($this->bom_entry1c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInitialization()
|
public function testInitialization(): void
|
||||||
{
|
{
|
||||||
//The values should be already prefilled correctly
|
//The values should be already prefilled correctly
|
||||||
$request = new ProjectBuildRequest($this->project1, 10);
|
$request = new ProjectBuildRequest($this->project1, 10);
|
||||||
|
@ -127,19 +127,19 @@ class ProjectBuildRequestTest extends TestCase
|
||||||
$this->assertEquals(2.5, $request->getLotWithdrawAmount($this->lot2));
|
$this->assertEquals(2.5, $request->getLotWithdrawAmount($this->lot2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNumberOfBuilds()
|
public function testGetNumberOfBuilds(): void
|
||||||
{
|
{
|
||||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||||
$this->assertEquals(5, $build_request->getNumberOfBuilds());
|
$this->assertEquals(5, $build_request->getNumberOfBuilds());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetProject()
|
public function testGetProject(): void
|
||||||
{
|
{
|
||||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||||
$this->assertEquals($this->project1, $build_request->getProject());
|
$this->assertEquals($this->project1, $build_request->getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNeededAmountForBOMEntry()
|
public function testGetNeededAmountForBOMEntry(): void
|
||||||
{
|
{
|
||||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||||
$this->assertEquals(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a));
|
$this->assertEquals(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a));
|
||||||
|
@ -147,7 +147,7 @@ class ProjectBuildRequestTest extends TestCase
|
||||||
$this->assertEquals(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c));
|
$this->assertEquals(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSetLotWithdrawAmount()
|
public function testGetSetLotWithdrawAmount(): void
|
||||||
{
|
{
|
||||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ class ProjectBuildRequestTest extends TestCase
|
||||||
$this->assertEquals(3, $build_request->getLotWithdrawAmount($this->lot1b));
|
$this->assertEquals(3, $build_request->getLotWithdrawAmount($this->lot1b));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetWithdrawAmountSum()
|
public function testGetWithdrawAmountSum(): void
|
||||||
{
|
{
|
||||||
//The sum of all withdraw amounts for an BOM entry (over all lots of the associated part) should be correct
|
//The sum of all withdraw amounts for an BOM entry (over all lots of the associated part) should be correct
|
||||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||||
|
|
|
@ -37,7 +37,7 @@ class SamlUserFactoryTest extends WebTestCase
|
||||||
$this->service = self::getContainer()->get(SamlUserFactory::class);
|
$this->service = self::getContainer()->get(SamlUserFactory::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCreateUser()
|
public function testCreateUser(): void
|
||||||
{
|
{
|
||||||
$user = $this->service->createUser('sso_user', [
|
$user = $this->service->createUser('sso_user', [
|
||||||
'email' => ['j.doe@invalid.invalid'],
|
'email' => ['j.doe@invalid.invalid'],
|
||||||
|
@ -63,7 +63,7 @@ class SamlUserFactoryTest extends WebTestCase
|
||||||
$this->assertEquals('j.doe@invalid.invalid', $user->getEmail());
|
$this->assertEquals('j.doe@invalid.invalid', $user->getEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMapSAMLRolesToLocalGroupID()
|
public function testMapSAMLRolesToLocalGroupID(): void
|
||||||
{
|
{
|
||||||
$mapping = [
|
$mapping = [
|
||||||
'admin' => 2, //This comes first, as this should have higher priority
|
'admin' => 2, //This comes first, as this should have higher priority
|
||||||
|
|
|
@ -39,13 +39,13 @@ class BigNumberNormalizerTest extends WebTestCase
|
||||||
$this->service = self::getContainer()->get(BigNumberNormalizer::class);
|
$this->service = self::getContainer()->get(BigNumberNormalizer::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalize()
|
public function testNormalize(): void
|
||||||
{
|
{
|
||||||
$bigDecimal = BigDecimal::of('1.23456789');
|
$bigDecimal = BigDecimal::of('1.23456789');
|
||||||
$this->assertSame('1.23456789', $this->service->normalize($bigDecimal));
|
$this->assertSame('1.23456789', $this->service->normalize($bigDecimal));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSupportsNormalization()
|
public function testSupportsNormalization(): void
|
||||||
{
|
{
|
||||||
//Normalizer must only support BigNumber objects (and child classes)
|
//Normalizer must only support BigNumber objects (and child classes)
|
||||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||||
|
|
|
@ -41,14 +41,14 @@ class PartNormalizerTest extends WebTestCase
|
||||||
$this->service = self::getContainer()->get(PartNormalizer::class);
|
$this->service = self::getContainer()->get(PartNormalizer::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSupportsNormalization()
|
public function testSupportsNormalization(): void
|
||||||
{
|
{
|
||||||
//Normalizer must only support Part objects (and child classes)
|
//Normalizer must only support Part objects (and child classes)
|
||||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||||
$this->assertTrue($this->service->supportsNormalization(new Part()));
|
$this->assertTrue($this->service->supportsNormalization(new Part()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalize()
|
public function testNormalize(): void
|
||||||
{
|
{
|
||||||
$part = new Part();
|
$part = new Part();
|
||||||
$part->setName('Test Part');
|
$part->setName('Test Part');
|
||||||
|
@ -70,7 +70,7 @@ class PartNormalizerTest extends WebTestCase
|
||||||
$this->assertArrayNotHasKey('type', $data);
|
$this->assertArrayNotHasKey('type', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSupportsDenormalization()
|
public function testSupportsDenormalization(): void
|
||||||
{
|
{
|
||||||
//Normalizer must only support Part type with array as input
|
//Normalizer must only support Part type with array as input
|
||||||
$this->assertFalse($this->service->supportsDenormalization(new \stdClass(), Part::class));
|
$this->assertFalse($this->service->supportsDenormalization(new \stdClass(), Part::class));
|
||||||
|
@ -79,7 +79,7 @@ class PartNormalizerTest extends WebTestCase
|
||||||
$this->assertTrue($this->service->supportsDenormalization(['a' => 'b'], Part::class));
|
$this->assertTrue($this->service->supportsDenormalization(['a' => 'b'], Part::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDenormalize()
|
public function testDenormalize(): void
|
||||||
{
|
{
|
||||||
$input = [
|
$input = [
|
||||||
'name' => 'Test Part',
|
'name' => 'Test Part',
|
||||||
|
|
|
@ -42,7 +42,7 @@ class StructuralElementNormalizerTest extends WebTestCase
|
||||||
$this->service = self::getContainer()->get(StructuralElementNormalizer::class);
|
$this->service = self::getContainer()->get(StructuralElementNormalizer::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalize()
|
public function testNormalize(): void
|
||||||
{
|
{
|
||||||
$category1 = (new Category())->setName('Category 1');
|
$category1 = (new Category())->setName('Category 1');
|
||||||
$category11 = (new Category())->setName('Category 1.1');
|
$category11 = (new Category())->setName('Category 1.1');
|
||||||
|
@ -65,7 +65,7 @@ class StructuralElementNormalizerTest extends WebTestCase
|
||||||
$this->assertArrayNotHasKey('type', $data11);
|
$this->assertArrayNotHasKey('type', $data11);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSupportsNormalization()
|
public function testSupportsNormalization(): void
|
||||||
{
|
{
|
||||||
//Normalizer must only support StructuralElement objects (and child classes)
|
//Normalizer must only support StructuralElement objects (and child classes)
|
||||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||||
|
|
|
@ -140,7 +140,7 @@ class AttachmentPathResolverTest extends WebTestCase
|
||||||
$this->assertSame($expected, $this->service->realPathToPlaceholder($param, $old_method));
|
$this->assertSame($expected, $this->service->realPathToPlaceholder($param, $old_method));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function germanFootprintPathdDataProvider()
|
public function germanFootprintPathdDataProvider(): ?\Generator
|
||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
$this->projectDir_orig = realpath(self::$kernel->getProjectDir());
|
$this->projectDir_orig = realpath(self::$kernel->getProjectDir());
|
||||||
|
|
|
@ -25,7 +25,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class EventCommentNeededHelperTest extends TestCase
|
class EventCommentNeededHelperTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testIsCommentNeeded()
|
public function testIsCommentNeeded(): void
|
||||||
{
|
{
|
||||||
$service = new EventCommentNeededHelper(['part_edit', 'part_create']);
|
$service = new EventCommentNeededHelper(['part_edit', 'part_create']);
|
||||||
$this->assertTrue($service->isCommentNeeded('part_edit'));
|
$this->assertTrue($service->isCommentNeeded('part_edit'));
|
||||||
|
@ -34,7 +34,7 @@ class EventCommentNeededHelperTest extends TestCase
|
||||||
$this->assertFalse($service->isCommentNeeded('part_stock_operation'));
|
$this->assertFalse($service->isCommentNeeded('part_stock_operation'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsCommentNeededInvalidTypeException()
|
public function testIsCommentNeededInvalidTypeException(): void
|
||||||
{
|
{
|
||||||
$service = new EventCommentNeededHelper(['part_edit', 'part_create']);
|
$service = new EventCommentNeededHelper(['part_edit', 'part_create']);
|
||||||
$this->expectException(\InvalidArgumentException::class);
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
|
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
class MySQLDumpXMLConverterTest extends TestCase
|
class MySQLDumpXMLConverterTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testConvertMySQLDumpXMLDataToArrayStructure()
|
public function testConvertMySQLDumpXMLDataToArrayStructure(): void
|
||||||
{
|
{
|
||||||
$service = new MySQLDumpXMLConverter();
|
$service = new MySQLDumpXMLConverter();
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
||||||
$this->lotWithUnknownInstock->setStorageLocation($this->storageLocation);
|
$this->lotWithUnknownInstock->setStorageLocation($this->storageLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCanWithdraw()
|
public function testCanWithdraw(): void
|
||||||
{
|
{
|
||||||
//Normal lots should be withdrawable
|
//Normal lots should be withdrawable
|
||||||
$this->assertTrue($this->service->canWithdraw($this->partLot1));
|
$this->assertTrue($this->service->canWithdraw($this->partLot1));
|
||||||
|
@ -103,7 +103,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
||||||
$this->assertFalse($this->service->canWithdraw($this->lotWithUnknownInstock));
|
$this->assertFalse($this->service->canWithdraw($this->lotWithUnknownInstock));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCanAdd()
|
public function testCanAdd(): void
|
||||||
{
|
{
|
||||||
//Normal lots should be addable
|
//Normal lots should be addable
|
||||||
$this->assertTrue($this->service->canAdd($this->partLot1));
|
$this->assertTrue($this->service->canAdd($this->partLot1));
|
||||||
|
@ -116,7 +116,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
||||||
$this->assertFalse($this->service->canAdd($this->lotWithUnknownInstock));
|
$this->assertFalse($this->service->canAdd($this->lotWithUnknownInstock));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdd()
|
public function testAdd(): void
|
||||||
{
|
{
|
||||||
//Add 5 to lot 1
|
//Add 5 to lot 1
|
||||||
$this->service->add($this->partLot1, 5, "Test");
|
$this->service->add($this->partLot1, 5, "Test");
|
||||||
|
@ -132,7 +132,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithdraw()
|
public function testWithdraw(): void
|
||||||
{
|
{
|
||||||
//Withdraw 5 from lot 1
|
//Withdraw 5 from lot 1
|
||||||
$this->service->withdraw($this->partLot1, 5, "Test");
|
$this->service->withdraw($this->partLot1, 5, "Test");
|
||||||
|
@ -143,7 +143,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
||||||
$this->assertEquals(0, $this->partLot2->getAmount());
|
$this->assertEquals(0, $this->partLot2->getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMove()
|
public function testMove(): void
|
||||||
{
|
{
|
||||||
//Move 5 from lot 1 to lot 2
|
//Move 5 from lot 1 to lot 2
|
||||||
$this->service->move($this->partLot1, $this->partLot2, 5, "Test");
|
$this->service->move($this->partLot1, $this->partLot2, 5, "Test");
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ProjectBuildHelperTest extends WebTestCase
|
||||||
$this->service = self::getContainer()->get(ProjectBuildHelper::class);
|
$this->service = self::getContainer()->get(ProjectBuildHelper::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetMaximumBuildableCountForBOMEntryNonPartBomEntry()
|
public function testGetMaximumBuildableCountForBOMEntryNonPartBomEntry(): void
|
||||||
{
|
{
|
||||||
$bom_entry = new ProjectBOMEntry();
|
$bom_entry = new ProjectBOMEntry();
|
||||||
$bom_entry->setPart(null);
|
$bom_entry->setPart(null);
|
||||||
|
@ -50,7 +50,7 @@ class ProjectBuildHelperTest extends WebTestCase
|
||||||
$this->service->getMaximumBuildableCountForBOMEntry($bom_entry);
|
$this->service->getMaximumBuildableCountForBOMEntry($bom_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetMaximumBuildableCountForBOMEntry()
|
public function testGetMaximumBuildableCountForBOMEntry(): void
|
||||||
{
|
{
|
||||||
$project_bom_entry = new ProjectBOMEntry();
|
$project_bom_entry = new ProjectBOMEntry();
|
||||||
$project_bom_entry->setQuantity(10);
|
$project_bom_entry->setQuantity(10);
|
||||||
|
@ -74,7 +74,7 @@ class ProjectBuildHelperTest extends WebTestCase
|
||||||
$this->assertEquals(0, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry));
|
$this->assertEquals(0, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetMaximumBuildableCount()
|
public function testGetMaximumBuildableCount(): void
|
||||||
{
|
{
|
||||||
$project = new Project();
|
$project = new Project();
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
||||||
$this->service = self::$container->get(PermissionSchemaUpdater::class);
|
$this->service = self::$container->get(PermissionSchemaUpdater::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsSchemaUpdateNeeded()
|
public function testIsSchemaUpdateNeeded(): void
|
||||||
{
|
{
|
||||||
$perm_data = new PermissionData();
|
$perm_data = new PermissionData();
|
||||||
$perm_data->setSchemaVersion(0);
|
$perm_data->setSchemaVersion(0);
|
||||||
|
@ -70,7 +70,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
||||||
self::assertFalse($this->service->isSchemaUpdateNeeded($user));
|
self::assertFalse($this->service->isSchemaUpdateNeeded($user));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpgradeSchema()
|
public function testUpgradeSchema(): void
|
||||||
{
|
{
|
||||||
$perm_data = new PermissionData();
|
$perm_data = new PermissionData();
|
||||||
$perm_data->setSchemaVersion(0);
|
$perm_data->setSchemaVersion(0);
|
||||||
|
@ -84,7 +84,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
||||||
self::assertFalse($this->service->upgradeSchema($user));
|
self::assertFalse($this->service->upgradeSchema($user));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpgradeSchemaToVersion1()
|
public function testUpgradeSchemaToVersion1(): void
|
||||||
{
|
{
|
||||||
$perm_data = new PermissionData();
|
$perm_data = new PermissionData();
|
||||||
$perm_data->setSchemaVersion(0);
|
$perm_data->setSchemaVersion(0);
|
||||||
|
@ -98,7 +98,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
||||||
self::assertEquals(PermissionData::ALLOW, $user->getPermissions()->getPermissionValue('parts_stock', 'withdraw'));
|
self::assertEquals(PermissionData::ALLOW, $user->getPermissions()->getPermissionValue('parts_stock', 'withdraw'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUpgradeSchemaToVersion2()
|
public function testUpgradeSchemaToVersion2(): void
|
||||||
{
|
{
|
||||||
$perm_data = new PermissionData();
|
$perm_data = new PermissionData();
|
||||||
$perm_data->setSchemaVersion(1);
|
$perm_data->setSchemaVersion(1);
|
||||||
|
|
|
@ -51,7 +51,7 @@ class EntityExtensionTest extends WebTestCase
|
||||||
$this->service = self::getContainer()->get(EntityExtension::class);
|
$this->service = self::getContainer()->get(EntityExtension::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetEntityType()
|
public function testGetEntityType(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals('part', $this->service->getEntityType(new Part()));
|
$this->assertEquals('part', $this->service->getEntityType(new Part()));
|
||||||
$this->assertEquals('footprint', $this->service->getEntityType(new Footprint()));
|
$this->assertEquals('footprint', $this->service->getEntityType(new Footprint()));
|
||||||
|
|
|
@ -55,7 +55,7 @@ class TwigCoreExtensionTest extends WebTestCase
|
||||||
private $test3 = 5;
|
private $test3 = 5;
|
||||||
private $test4 = 7;
|
private $test4 = 7;
|
||||||
|
|
||||||
public function getTest4()
|
public function getTest4(): int
|
||||||
{
|
{
|
||||||
return $this->test4;
|
return $this->test4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class UserExtensionTest extends WebTestCase
|
||||||
$this->service = self::getContainer()->get(UserExtension::class);
|
$this->service = self::getContainer()->get(UserExtension::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeeLocaleFromPathDataSet()
|
public function removeeLocaleFromPathDataSet(): ?\Generator
|
||||||
{
|
{
|
||||||
yield ['/', '/de/'];
|
yield ['/', '/de/'];
|
||||||
yield ['/test', '/de/test'];
|
yield ['/test', '/de/test'];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue