mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-15 04:44:36 +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
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\TestCase;
|
|||
class PermissionDataTest extends TestCase
|
||||
{
|
||||
|
||||
public function testGetSetIs()
|
||||
public function testGetSetIs(): void
|
||||
{
|
||||
$perm_data = new PermissionData();
|
||||
|
||||
|
@ -60,7 +60,7 @@ class PermissionDataTest extends TestCase
|
|||
$this->assertFalse($perm_data->isPermissionSet('p1', 'op1'));
|
||||
}
|
||||
|
||||
public function testJSONSerialization()
|
||||
public function testJSONSerialization(): void
|
||||
{
|
||||
$perm_data = new PermissionData();
|
||||
|
||||
|
@ -99,7 +99,7 @@ class PermissionDataTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
public function testFromJSON()
|
||||
public function testFromJSON(): void
|
||||
{
|
||||
$json = json_encode([
|
||||
'perm1' => [
|
||||
|
@ -120,7 +120,7 @@ class PermissionDataTest extends TestCase
|
|||
$this->assertFalse($perm_data->getPermissionValue('perm2', 'op2'));
|
||||
}
|
||||
|
||||
public function testResetPermissions()
|
||||
public function testResetPermissions(): void
|
||||
{
|
||||
$data = new PermissionData();
|
||||
|
||||
|
@ -147,7 +147,7 @@ class PermissionDataTest extends TestCase
|
|||
$this->assertFalse($data->isPermissionSet('perm1', 'op3'));
|
||||
}
|
||||
|
||||
public function testGetSchemaVersion()
|
||||
public function testGetSchemaVersion(): void
|
||||
{
|
||||
$data = new PermissionData();
|
||||
|
||||
|
@ -159,7 +159,7 @@ class PermissionDataTest extends TestCase
|
|||
$this->assertEquals(12345, $data->getSchemaVersion());
|
||||
}
|
||||
|
||||
public function testIsAnyOperationOfPermissionSet()
|
||||
public function testIsAnyOperationOfPermissionSet(): void
|
||||
{
|
||||
$data = new PermissionData();
|
||||
|
||||
|
@ -170,7 +170,7 @@ class PermissionDataTest extends TestCase
|
|||
$this->assertTrue($data->isAnyOperationOfPermissionSet('perm1'));
|
||||
}
|
||||
|
||||
public function testGetAllDefinedOperationsOfPermission()
|
||||
public function testGetAllDefinedOperationsOfPermission(): void
|
||||
{
|
||||
$data = new PermissionData();
|
||||
|
||||
|
@ -185,7 +185,7 @@ class PermissionDataTest extends TestCase
|
|||
$data->getAllDefinedOperationsOfPermission('perm1'));
|
||||
}
|
||||
|
||||
public function testSetAllOperationsOfPermission()
|
||||
public function testSetAllOperationsOfPermission(): void
|
||||
{
|
||||
$data = new PermissionData();
|
||||
|
||||
|
@ -200,7 +200,7 @@ class PermissionDataTest extends TestCase
|
|||
$data->getAllDefinedOperationsOfPermission('perm1'));
|
||||
}
|
||||
|
||||
public function testRemovePermission()
|
||||
public function testRemovePermission(): void
|
||||
{
|
||||
$data = new PermissionData();
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ class ProjectBuildRequestTest extends TestCase
|
|||
$this->project1->addBomEntry($this->bom_entry1c);
|
||||
}
|
||||
|
||||
public function testInitialization()
|
||||
public function testInitialization(): void
|
||||
{
|
||||
//The values should be already prefilled correctly
|
||||
$request = new ProjectBuildRequest($this->project1, 10);
|
||||
|
@ -127,19 +127,19 @@ class ProjectBuildRequestTest extends TestCase
|
|||
$this->assertEquals(2.5, $request->getLotWithdrawAmount($this->lot2));
|
||||
}
|
||||
|
||||
public function testGetNumberOfBuilds()
|
||||
public function testGetNumberOfBuilds(): void
|
||||
{
|
||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||
$this->assertEquals(5, $build_request->getNumberOfBuilds());
|
||||
}
|
||||
|
||||
public function testGetProject()
|
||||
public function testGetProject(): void
|
||||
{
|
||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||
$this->assertEquals($this->project1, $build_request->getProject());
|
||||
}
|
||||
|
||||
public function testGetNeededAmountForBOMEntry()
|
||||
public function testGetNeededAmountForBOMEntry(): void
|
||||
{
|
||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||
$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));
|
||||
}
|
||||
|
||||
public function testGetSetLotWithdrawAmount()
|
||||
public function testGetSetLotWithdrawAmount(): void
|
||||
{
|
||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||
|
||||
|
@ -160,7 +160,7 @@ class ProjectBuildRequestTest extends TestCase
|
|||
$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
|
||||
$build_request = new ProjectBuildRequest($this->project1, 5);
|
||||
|
|
|
@ -37,7 +37,7 @@ class SamlUserFactoryTest extends WebTestCase
|
|||
$this->service = self::getContainer()->get(SamlUserFactory::class);
|
||||
}
|
||||
|
||||
public function testCreateUser()
|
||||
public function testCreateUser(): void
|
||||
{
|
||||
$user = $this->service->createUser('sso_user', [
|
||||
'email' => ['j.doe@invalid.invalid'],
|
||||
|
@ -63,7 +63,7 @@ class SamlUserFactoryTest extends WebTestCase
|
|||
$this->assertEquals('j.doe@invalid.invalid', $user->getEmail());
|
||||
}
|
||||
|
||||
public function testMapSAMLRolesToLocalGroupID()
|
||||
public function testMapSAMLRolesToLocalGroupID(): void
|
||||
{
|
||||
$mapping = [
|
||||
'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);
|
||||
}
|
||||
|
||||
public function testNormalize()
|
||||
public function testNormalize(): void
|
||||
{
|
||||
$bigDecimal = BigDecimal::of('1.23456789');
|
||||
$this->assertSame('1.23456789', $this->service->normalize($bigDecimal));
|
||||
}
|
||||
|
||||
public function testSupportsNormalization()
|
||||
public function testSupportsNormalization(): void
|
||||
{
|
||||
//Normalizer must only support BigNumber objects (and child classes)
|
||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||
|
|
|
@ -41,14 +41,14 @@ class PartNormalizerTest extends WebTestCase
|
|||
$this->service = self::getContainer()->get(PartNormalizer::class);
|
||||
}
|
||||
|
||||
public function testSupportsNormalization()
|
||||
public function testSupportsNormalization(): void
|
||||
{
|
||||
//Normalizer must only support Part objects (and child classes)
|
||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||
$this->assertTrue($this->service->supportsNormalization(new Part()));
|
||||
}
|
||||
|
||||
public function testNormalize()
|
||||
public function testNormalize(): void
|
||||
{
|
||||
$part = new Part();
|
||||
$part->setName('Test Part');
|
||||
|
@ -70,7 +70,7 @@ class PartNormalizerTest extends WebTestCase
|
|||
$this->assertArrayNotHasKey('type', $data);
|
||||
}
|
||||
|
||||
public function testSupportsDenormalization()
|
||||
public function testSupportsDenormalization(): void
|
||||
{
|
||||
//Normalizer must only support Part type with array as input
|
||||
$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));
|
||||
}
|
||||
|
||||
public function testDenormalize()
|
||||
public function testDenormalize(): void
|
||||
{
|
||||
$input = [
|
||||
'name' => 'Test Part',
|
||||
|
|
|
@ -42,7 +42,7 @@ class StructuralElementNormalizerTest extends WebTestCase
|
|||
$this->service = self::getContainer()->get(StructuralElementNormalizer::class);
|
||||
}
|
||||
|
||||
public function testNormalize()
|
||||
public function testNormalize(): void
|
||||
{
|
||||
$category1 = (new Category())->setName('Category 1');
|
||||
$category11 = (new Category())->setName('Category 1.1');
|
||||
|
@ -65,7 +65,7 @@ class StructuralElementNormalizerTest extends WebTestCase
|
|||
$this->assertArrayNotHasKey('type', $data11);
|
||||
}
|
||||
|
||||
public function testSupportsNormalization()
|
||||
public function testSupportsNormalization(): void
|
||||
{
|
||||
//Normalizer must only support StructuralElement objects (and child classes)
|
||||
$this->assertFalse($this->service->supportsNormalization(new \stdClass()));
|
||||
|
|
|
@ -140,7 +140,7 @@ class AttachmentPathResolverTest extends WebTestCase
|
|||
$this->assertSame($expected, $this->service->realPathToPlaceholder($param, $old_method));
|
||||
}
|
||||
|
||||
public function germanFootprintPathdDataProvider()
|
||||
public function germanFootprintPathdDataProvider(): ?\Generator
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->projectDir_orig = realpath(self::$kernel->getProjectDir());
|
||||
|
|
|
@ -25,7 +25,7 @@ use PHPUnit\Framework\TestCase;
|
|||
|
||||
class EventCommentNeededHelperTest extends TestCase
|
||||
{
|
||||
public function testIsCommentNeeded()
|
||||
public function testIsCommentNeeded(): void
|
||||
{
|
||||
$service = new EventCommentNeededHelper(['part_edit', 'part_create']);
|
||||
$this->assertTrue($service->isCommentNeeded('part_edit'));
|
||||
|
@ -34,7 +34,7 @@ class EventCommentNeededHelperTest extends TestCase
|
|||
$this->assertFalse($service->isCommentNeeded('part_stock_operation'));
|
||||
}
|
||||
|
||||
public function testIsCommentNeededInvalidTypeException()
|
||||
public function testIsCommentNeededInvalidTypeException(): void
|
||||
{
|
||||
$service = new EventCommentNeededHelper(['part_edit', 'part_create']);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\TestCase;
|
|||
class MySQLDumpXMLConverterTest extends TestCase
|
||||
{
|
||||
|
||||
public function testConvertMySQLDumpXMLDataToArrayStructure()
|
||||
public function testConvertMySQLDumpXMLDataToArrayStructure(): void
|
||||
{
|
||||
$service = new MySQLDumpXMLConverter();
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
|||
$this->lotWithUnknownInstock->setStorageLocation($this->storageLocation);
|
||||
}
|
||||
|
||||
public function testCanWithdraw()
|
||||
public function testCanWithdraw(): void
|
||||
{
|
||||
//Normal lots should be withdrawable
|
||||
$this->assertTrue($this->service->canWithdraw($this->partLot1));
|
||||
|
@ -103,7 +103,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
|||
$this->assertFalse($this->service->canWithdraw($this->lotWithUnknownInstock));
|
||||
}
|
||||
|
||||
public function testCanAdd()
|
||||
public function testCanAdd(): void
|
||||
{
|
||||
//Normal lots should be addable
|
||||
$this->assertTrue($this->service->canAdd($this->partLot1));
|
||||
|
@ -116,7 +116,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
|||
$this->assertFalse($this->service->canAdd($this->lotWithUnknownInstock));
|
||||
}
|
||||
|
||||
public function testAdd()
|
||||
public function testAdd(): void
|
||||
{
|
||||
//Add 5 to lot 1
|
||||
$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
|
||||
$this->service->withdraw($this->partLot1, 5, "Test");
|
||||
|
@ -143,7 +143,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
|||
$this->assertEquals(0, $this->partLot2->getAmount());
|
||||
}
|
||||
|
||||
public function testMove()
|
||||
public function testMove(): void
|
||||
{
|
||||
//Move 5 from lot 1 to lot 2
|
||||
$this->service->move($this->partLot1, $this->partLot2, 5, "Test");
|
||||
|
|
|
@ -39,7 +39,7 @@ class ProjectBuildHelperTest extends WebTestCase
|
|||
$this->service = self::getContainer()->get(ProjectBuildHelper::class);
|
||||
}
|
||||
|
||||
public function testGetMaximumBuildableCountForBOMEntryNonPartBomEntry()
|
||||
public function testGetMaximumBuildableCountForBOMEntryNonPartBomEntry(): void
|
||||
{
|
||||
$bom_entry = new ProjectBOMEntry();
|
||||
$bom_entry->setPart(null);
|
||||
|
@ -50,7 +50,7 @@ class ProjectBuildHelperTest extends WebTestCase
|
|||
$this->service->getMaximumBuildableCountForBOMEntry($bom_entry);
|
||||
}
|
||||
|
||||
public function testGetMaximumBuildableCountForBOMEntry()
|
||||
public function testGetMaximumBuildableCountForBOMEntry(): void
|
||||
{
|
||||
$project_bom_entry = new ProjectBOMEntry();
|
||||
$project_bom_entry->setQuantity(10);
|
||||
|
@ -74,7 +74,7 @@ class ProjectBuildHelperTest extends WebTestCase
|
|||
$this->assertEquals(0, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry));
|
||||
}
|
||||
|
||||
public function testGetMaximumBuildableCount()
|
||||
public function testGetMaximumBuildableCount(): void
|
||||
{
|
||||
$project = new Project();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
|||
$this->service = self::$container->get(PermissionSchemaUpdater::class);
|
||||
}
|
||||
|
||||
public function testIsSchemaUpdateNeeded()
|
||||
public function testIsSchemaUpdateNeeded(): void
|
||||
{
|
||||
$perm_data = new PermissionData();
|
||||
$perm_data->setSchemaVersion(0);
|
||||
|
@ -70,7 +70,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
|||
self::assertFalse($this->service->isSchemaUpdateNeeded($user));
|
||||
}
|
||||
|
||||
public function testUpgradeSchema()
|
||||
public function testUpgradeSchema(): void
|
||||
{
|
||||
$perm_data = new PermissionData();
|
||||
$perm_data->setSchemaVersion(0);
|
||||
|
@ -84,7 +84,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
|||
self::assertFalse($this->service->upgradeSchema($user));
|
||||
}
|
||||
|
||||
public function testUpgradeSchemaToVersion1()
|
||||
public function testUpgradeSchemaToVersion1(): void
|
||||
{
|
||||
$perm_data = new PermissionData();
|
||||
$perm_data->setSchemaVersion(0);
|
||||
|
@ -98,7 +98,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
|||
self::assertEquals(PermissionData::ALLOW, $user->getPermissions()->getPermissionValue('parts_stock', 'withdraw'));
|
||||
}
|
||||
|
||||
public function testUpgradeSchemaToVersion2()
|
||||
public function testUpgradeSchemaToVersion2(): void
|
||||
{
|
||||
$perm_data = new PermissionData();
|
||||
$perm_data->setSchemaVersion(1);
|
||||
|
|
|
@ -51,7 +51,7 @@ class EntityExtensionTest extends WebTestCase
|
|||
$this->service = self::getContainer()->get(EntityExtension::class);
|
||||
}
|
||||
|
||||
public function testGetEntityType()
|
||||
public function testGetEntityType(): void
|
||||
{
|
||||
$this->assertEquals('part', $this->service->getEntityType(new Part()));
|
||||
$this->assertEquals('footprint', $this->service->getEntityType(new Footprint()));
|
||||
|
|
|
@ -55,7 +55,7 @@ class TwigCoreExtensionTest extends WebTestCase
|
|||
private $test3 = 5;
|
||||
private $test4 = 7;
|
||||
|
||||
public function getTest4()
|
||||
public function getTest4(): int
|
||||
{
|
||||
return $this->test4;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class UserExtensionTest extends WebTestCase
|
|||
$this->service = self::getContainer()->get(UserExtension::class);
|
||||
}
|
||||
|
||||
public function removeeLocaleFromPathDataSet()
|
||||
public function removeeLocaleFromPathDataSet(): ?\Generator
|
||||
{
|
||||
yield ['/', '/de/'];
|
||||
yield ['/test', '/de/test'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue