mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-01 16:54:32 +02:00
Fixed typos
This commit is contained in:
parent
63df16a369
commit
d04d743520
144 changed files with 263 additions and 265 deletions
|
@ -76,7 +76,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
|
|||
/**
|
||||
* @dataProvider readDataProvider
|
||||
* @group slow
|
||||
* Tests if it possible to access an specific entity. Checks if permissions are working.
|
||||
* Tests if it is possible to access a specific entity. Checks if permissions are working.
|
||||
*/
|
||||
public function testReadEntity(string $user, bool $read): void
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ class RedirectControllerTest extends WebTestCase
|
|||
['en', '/', '/en/'],
|
||||
['en', '/category/new', '/en/category/new'],
|
||||
['en_US', '/part/3', '/en_US/part/3'],
|
||||
//Without an explicit set value, the user should be redirect to english version
|
||||
//Without an explicit set value, the user should be redirected to english version
|
||||
[null, '/', '/en/'],
|
||||
['en_US', '/part/3', '/en_US/part/3'],
|
||||
//Test that query parameters work
|
||||
|
|
|
@ -105,7 +105,7 @@ class AttachmentTest extends TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that all attachment subclasses like PartAttachment or similar returns an exception, when an not allowed
|
||||
* Test that all attachment subclasses like PartAttachment or similar returns an exception, when a not allowed
|
||||
* element is passed.
|
||||
*
|
||||
* @dataProvider subClassesDataProvider
|
||||
|
|
|
@ -151,7 +151,7 @@ class AbstractStructuralDBElementTest extends TestCase
|
|||
$this->assertSame([$this->child1_1, $this->child1_2], $this->child1->getSubelements()->toArray());
|
||||
$this->assertSame([], $this->child1_1->getSubelements()->toArray());
|
||||
|
||||
//If a element is set as its own parent, it should not be returned as a subelement
|
||||
//If an element is set as its own parent, it should not be returned as a subelement
|
||||
$this->child1->setParent($this->child1);
|
||||
$this->assertSame([], $this->child1->getSubelements()->toArray());
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ class AbstractLogEntryTest extends TestCase
|
|||
{
|
||||
$log = new UserLoginLogEntry('1.1.1.1');
|
||||
|
||||
//By default no no CLI username is set
|
||||
//By default, no CLI username is set
|
||||
$this->assertNull($log->getCLIUsername());
|
||||
$this->assertFalse($log->isCLIEntry());
|
||||
|
||||
|
|
|
@ -53,11 +53,11 @@ class PartTest extends TestCase
|
|||
$part = new Part();
|
||||
$measurement_unit = new MeasurementUnit();
|
||||
|
||||
//Without an set measurement unit the part must return an int
|
||||
//Without a set measurement unit the part must return an int
|
||||
$part->setMinAmount(1.345);
|
||||
$this->assertSame(1.0, $part->getMinAmount());
|
||||
|
||||
//If an non int-based unit is assigned, an float is returned
|
||||
//If a non-int-based unit is assigned, a float is returned
|
||||
$part->setPartUnit($measurement_unit);
|
||||
$this->assertSame(1.345, $part->getMinAmount());
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class CurrencyTest extends TestCase
|
|||
{
|
||||
$currency = new Currency();
|
||||
|
||||
//By default the inverse exchange rate is not set:
|
||||
//By default, the inverse exchange rate is not set:
|
||||
$this->assertNull($currency->getInverseExchangeRate());
|
||||
|
||||
$currency->setExchangeRate(BigDecimal::zero());
|
||||
|
|
|
@ -69,7 +69,7 @@ class PricedetailTest extends TestCase
|
|||
$pricedetail->setPriceRelatedQuantity(0.23);
|
||||
$this->assertSame(1.0, $pricedetail->getPriceRelatedQuantity());
|
||||
|
||||
//With an part that has an float amount unit, also values like 0.23 can be returned
|
||||
//With a part that has a float amount unit, also values like 0.23 can be returned
|
||||
$pricedetail->setOrderdetail($orderdetail2);
|
||||
$this->assertSame(0.23, $pricedetail->getPriceRelatedQuantity());
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ class PricedetailTest extends TestCase
|
|||
$pricedetail->setMinDiscountQuantity(0.23);
|
||||
$this->assertSame(1.0, $pricedetail->getMinDiscountQuantity());
|
||||
|
||||
//With an part that has an float amount unit, also values like 0.23 can be returned
|
||||
//With a part that has a float amount unit, also values like 0.23 can be returned
|
||||
$pricedetail->setOrderdetail($orderdetail2);
|
||||
$this->assertSame(0.23, $pricedetail->getMinDiscountQuantity());
|
||||
}
|
||||
|
|
|
@ -106,12 +106,12 @@ class UserTest extends TestCase
|
|||
//Ensure the code is valid
|
||||
$this->assertTrue($user->isBackupCode('aaaa'));
|
||||
$this->assertTrue($user->isBackupCode('bbbb'));
|
||||
//Invalidate code, afterwards the code has to be invalid!
|
||||
//Invalidate code, afterward the code has to be invalid!
|
||||
$user->invalidateBackupCode('bbbb');
|
||||
$this->assertFalse($user->isBackupCode('bbbb'));
|
||||
$this->assertTrue($user->isBackupCode('aaaa'));
|
||||
|
||||
//No exception must happen, when we try to invalidate an not existing backup key!
|
||||
//No exception must happen, when we try to invalidate a not existing backup key!
|
||||
$user->invalidateBackupCode('zzzz');
|
||||
}
|
||||
|
||||
|
|
|
@ -45,15 +45,15 @@ class PasswordChangeNeededSubscriberTest extends TestCase
|
|||
$user->setGroup($group);
|
||||
$this->assertFalse(PasswordChangeNeededSubscriber::TFARedirectNeeded($user));
|
||||
|
||||
//The user must be redirected if the group enforces 2FA and it does not have a method
|
||||
//The user must be redirected if the group enforces 2FA, and it does not have a method
|
||||
$group->setEnforce2FA(true);
|
||||
$this->assertTrue(PasswordChangeNeededSubscriber::TFARedirectNeeded($user));
|
||||
|
||||
//User must not be redirect if google authenticator is setup
|
||||
//User must not be redirect if google authenticator is set up
|
||||
$user->setGoogleAuthenticatorSecret('abcd');
|
||||
$this->assertFalse(PasswordChangeNeededSubscriber::TFARedirectNeeded($user));
|
||||
|
||||
//User must not be redirect if 2FA is setup
|
||||
//User must not be redirect if 2FA is set up
|
||||
$user->setGoogleAuthenticatorSecret(null);
|
||||
$user->addWebauthnKey(new WebauthnKey(
|
||||
"Test",
|
||||
|
|
|
@ -79,7 +79,7 @@ class SamlUserFactoryTest extends WebTestCase
|
|||
$this->assertSame(2, $this->service->mapSAMLRolesToLocalGroupID(['does_not_matter', 'admin', 'employee'], $mapping));
|
||||
$this->assertSame(1, $this->service->mapSAMLRolesToLocalGroupID(['employee', 'does_not_matter', 'manager'], $mapping));
|
||||
$this->assertSame(3, $this->service->mapSAMLRolesToLocalGroupID(['administrator', 'does_not_matter', 'manager'], $mapping));
|
||||
//Test if mapping is case sensitive
|
||||
//Test if mapping is case-sensitive
|
||||
$this->assertEquals(4, $this->service->mapSAMLRolesToLocalGroupID(['ADMIN'], $mapping));
|
||||
|
||||
//Test that wildcard mapping works
|
||||
|
|
|
@ -42,10 +42,10 @@ class UserCheckerTest extends WebTestCase
|
|||
$user = new User();
|
||||
$user->setDisabled(false);
|
||||
|
||||
//An user that is not disabled should not throw an exception
|
||||
//A user that is not disabled should not throw an exception
|
||||
$this->service->checkPostAuth($user);
|
||||
|
||||
//An disabled user must throw an exception
|
||||
//A disabled user must throw an exception
|
||||
$user->setDisabled(true);
|
||||
$this->expectException(CustomUserMessageAccountStatusException::class);
|
||||
$this->service->checkPostAuth($user);
|
||||
|
|
|
@ -35,7 +35,7 @@ class PartNormalizerTest extends WebTestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(PartNormalizer::class);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class StructuralElementDenormalizerTest extends WebTestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(StructuralElementDenormalizer::class);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class StructuralElementFromNameDenormalizerTest extends WebTestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(StructuralElementFromNameDenormalizer::class);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ class StructuralElementFromNameDenormalizerTest extends WebTestCase
|
|||
$this->assertNotNull($category->getID());
|
||||
$this->assertNotNull($category->getParent()->getID());
|
||||
|
||||
//Test with non existing category
|
||||
//Test with non-existing category
|
||||
$category = $this->service->denormalize('New category', Category::class, null, $context);
|
||||
$this->assertNull($category);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class AttachmentPathResolverTest extends WebTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
|
||||
$this->projectDir_orig = realpath(self::$kernel->getProjectDir());
|
||||
|
@ -117,7 +117,7 @@ class AttachmentPathResolverTest extends WebTestCase
|
|||
//Every kind of absolute path, that is not based with our placeholder dirs must be invald
|
||||
['/etc/passwd', null],
|
||||
['C:\\not\\existing.txt', null],
|
||||
//More then one placeholder is not allowed
|
||||
//More than one placeholder is not allowed
|
||||
[$this->footprint_path.'/test/'.$this->footprint_path, null],
|
||||
//Path must begin with path
|
||||
['/not/root'.$this->footprint_path, null],
|
||||
|
|
|
@ -33,7 +33,7 @@ class AttachmentURLGeneratorTest extends WebTestCase
|
|||
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
self::$service = self::getContainer()->get(AttachmentURLGenerator::class);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class BuiltinAttachmentsFinderTest extends WebTestCase
|
|||
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
self::$service = self::getContainer()->get(BuiltinAttachmentsFinder::class);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class AmountFormatterTest extends WebTestCase
|
|||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(AmountFormatter::class);
|
||||
}
|
||||
|
|
|
@ -38,14 +38,14 @@ class BOMImporterTest extends WebTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(BOMImporter::class);
|
||||
}
|
||||
|
||||
public function testImportFileIntoProject(): void
|
||||
{
|
||||
$inpute = $input = <<<CSV
|
||||
$input = <<<CSV
|
||||
"ID";"Bezeichner";"Footprint";"Stückzahl";"Bezeichnung";"Anbieter und Referenz";
|
||||
1;"R19,R17";"R_0805_2012Metric_Pad1.20x1.40mm_HandSolder";2;"4.7k";Test;;
|
||||
2;"D1";"D_DO-41_SOD81_P10.16mm_Horizontal";1;"1N5059";;;
|
||||
|
|
|
@ -44,7 +44,7 @@ class EntityImporterTest extends WebTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(EntityImporter::class);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ EOT;
|
|||
$parent = new AttachmentType();
|
||||
$results = $this->service->massCreation($input, AttachmentType::class, $parent, $errors);
|
||||
|
||||
//We have 7 elements, an now errros
|
||||
//We have 7 elements, and 0 errors
|
||||
$this->assertCount(0, $errors);
|
||||
$this->assertCount(7, $results);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class LabelTextReplacerTest extends WebTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(LabelTextReplacer::class);
|
||||
|
||||
|
|
|
@ -139,5 +139,7 @@ class SandboxedTwigProviderTest extends WebTestCase
|
|||
'lot' => new PartLot(),
|
||||
'location' => new Storelocation(),
|
||||
]);
|
||||
|
||||
$this->assertIsString($str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class EventCommentHelperTest extends WebTestCase
|
|||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(EventCommentHelper::class);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class EventLoggerTest extends WebTestCase
|
|||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(EventLogger::class);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class FAIconGeneratorTest extends WebTestCase
|
|||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(FAIconGenerator::class);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class ParameterExtractorTest extends WebTestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(ParameterExtractor::class);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(PartLotWithdrawAddHelper::class);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class PricedetailHelperTest extends WebTestCase
|
|||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(PricedetailHelper::class);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class TreeViewGeneratorTest extends WebTestCase
|
|||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(TreeViewGenerator::class);
|
||||
$this->em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
@ -99,7 +99,7 @@ class TreeViewGeneratorTest extends WebTestCase
|
|||
//First element should link to new category
|
||||
$this->assertStringContainsStringIgnoringCase('New', $tree[0]->getText());
|
||||
$this->assertSame('/en/category/new', $tree[0]->getHref());
|
||||
//By default the new element node is selected
|
||||
//By default, the new element node is selected
|
||||
$this->assertTrue($tree[0]->getState()->getSelected());
|
||||
|
||||
//Next element is spacing
|
||||
|
|
|
@ -45,7 +45,7 @@ class PermissionManagerTest extends WebTestCase
|
|||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(PermissionManager::class);
|
||||
|
||||
|
@ -155,7 +155,7 @@ class PermissionManagerTest extends WebTestCase
|
|||
|
||||
public function testInherit(): void
|
||||
{
|
||||
//Not inherited values should be same as dont inherit:
|
||||
//Not inherited values should be same as don't inherit:
|
||||
$this->assertTrue($this->service->inherit($this->user, 'parts', 'read'));
|
||||
$this->assertFalse($this->service->inherit($this->user, 'parts', 'edit'));
|
||||
//When thing can not be resolved null should be returned
|
||||
|
|
|
@ -90,7 +90,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
|
|||
$perm_data->setPermissionValue('parts', 'edit', PermissionData::ALLOW);
|
||||
$user = new TestPermissionHolder($perm_data);
|
||||
|
||||
//Do an upgrade and afterwards the move, add, and withdraw permissions should be set to ALLOW
|
||||
//Do an upgrade and afterward the move, add, and withdraw permissions should be set to ALLOW
|
||||
self::assertTrue($this->service->upgradeSchema($user, 1));
|
||||
self::assertEquals(PermissionData::ALLOW, $user->getPermissions()->getPermissionValue('parts_stock', 'move'));
|
||||
self::assertEquals(PermissionData::ALLOW, $user->getPermissions()->getPermissionValue('parts_stock', 'add'));
|
||||
|
|
|
@ -68,7 +68,7 @@ class BackupCodeManagerTest extends WebTestCase
|
|||
{
|
||||
$user = new User();
|
||||
|
||||
//By default nothing other 2FA is activated, so the backup codes should be disabled
|
||||
//By default, nothing other 2FA is activated, so the backup codes should be disabled
|
||||
$codes = ['aaaa', 'bbbb'];
|
||||
$user->setBackupCodes($codes);
|
||||
$this->service->disableBackupCodesIfUnused($user);
|
||||
|
|
|
@ -45,7 +45,7 @@ class EntityExtensionTest extends WebTestCase
|
|||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
//Get a service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(EntityExtension::class);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue