diff --git a/rector.php b/rector.php
index db559491..dbcefaf6 100644
--- a/rector.php
+++ b/rector.php
@@ -47,7 +47,6 @@ return static function (RectorConfig $rectorConfig): void {
//PHPUnit rules
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
- PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);
};
diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php
index e73e639a..e52911eb 100644
--- a/tests/DataTables/Filters/CompoundFilterTraitTest.php
+++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php
@@ -75,6 +75,9 @@ class CompoundFilterTraitTest extends TestCase
], $result);
}
+ /**
+ * @doesNotPerformAssertions
+ */
public function testApplyAllChildFilters(): void
{
$f1 = $this->createMock(FilterInterface::class);
diff --git a/tests/Entity/UserSystem/PermissionDataTest.php b/tests/Entity/UserSystem/PermissionDataTest.php
index 0536cd5b..d1f0ed59 100644
--- a/tests/Entity/UserSystem/PermissionDataTest.php
+++ b/tests/Entity/UserSystem/PermissionDataTest.php
@@ -152,11 +152,11 @@ class PermissionDataTest extends TestCase
$data = new PermissionData();
//By default the schema version must be the CURRENT_SCHEMA_VERSION
- $this->assertEquals(PermissionData::CURRENT_SCHEMA_VERSION, $data->getSchemaVersion());
+ $this->assertSame(PermissionData::CURRENT_SCHEMA_VERSION, $data->getSchemaVersion());
//Ensure that the schema version can be set
$data->setSchemaVersion(12345);
- $this->assertEquals(12345, $data->getSchemaVersion());
+ $this->assertSame(12345, $data->getSchemaVersion());
}
public function testIsAnyOperationOfPermissionSet(): void
diff --git a/tests/Helpers/BBCodeToMarkdownConverterTest.php b/tests/Helpers/BBCodeToMarkdownConverterTest.php
index a4703d95..093ff98f 100644
--- a/tests/Helpers/BBCodeToMarkdownConverterTest.php
+++ b/tests/Helpers/BBCodeToMarkdownConverterTest.php
@@ -34,17 +34,15 @@ class BBCodeToMarkdownConverterTest extends TestCase
$this->converter = new BBCodeToMarkdownConverter();
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- ['[b]Bold[/b]', '**Bold**'],
- ['[i]Italic[/i]', '*Italic*'],
- ['[s]Strike[/s]', 'Strike'],
- ['[url]https://foo.bar[/url]', ''],
- ['[url=https://foo.bar]test[/url]', '[test](https://foo.bar)'],
- ['[center]Centered[/center]', 'Centered
'],
- ['test no change', 'test no change'],
- ];
+ yield ['[b]Bold[/b]', '**Bold**'];
+ yield ['[i]Italic[/i]', '*Italic*'];
+ yield ['[s]Strike[/s]', 'Strike'];
+ yield ['[url]https://foo.bar[/url]', ''];
+ yield ['[url=https://foo.bar]test[/url]', '[test](https://foo.bar)'];
+ yield ['[center]Centered[/center]', 'Centered
'];
+ yield ['test no change', 'test no change'];
}
/**
diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php
index 8cc8dc2b..49bfede7 100644
--- a/tests/Helpers/Projects/ProjectBuildRequestTest.php
+++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php
@@ -118,17 +118,17 @@ class ProjectBuildRequestTest extends TestCase
//The values should be already prefilled correctly
$request = new ProjectBuildRequest($this->project1, 10);
//We need totally 20: Take 10 from the first (maximum 10) and 10 from the second (maximum 20)
- $this->assertEquals(10, $request->getLotWithdrawAmount($this->lot1a));
- $this->assertEquals(10, $request->getLotWithdrawAmount($this->lot1b));
+ $this->assertSame(10, $request->getLotWithdrawAmount($this->lot1a));
+ $this->assertSame(10, $request->getLotWithdrawAmount($this->lot1b));
//If the needed amount is higher than the maximum, we should get the maximum
- $this->assertEquals(2.5, $request->getLotWithdrawAmount($this->lot2));
+ $this->assertSame(2.5, $request->getLotWithdrawAmount($this->lot2));
}
public function testGetNumberOfBuilds(): void
{
$build_request = new ProjectBuildRequest($this->project1, 5);
- $this->assertEquals(5, $build_request->getNumberOfBuilds());
+ $this->assertSame(5, $build_request->getNumberOfBuilds());
}
public function testGetProject(): void
@@ -140,9 +140,9 @@ class ProjectBuildRequestTest extends TestCase
public function testGetNeededAmountForBOMEntry(): void
{
$build_request = new ProjectBuildRequest($this->project1, 5);
- $this->assertEquals(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a));
- $this->assertEquals(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b));
- $this->assertEquals(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c));
+ $this->assertSame(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a));
+ $this->assertSame(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b));
+ $this->assertSame(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c));
}
public function testGetSetLotWithdrawAmount(): void
@@ -154,8 +154,8 @@ class ProjectBuildRequestTest extends TestCase
$build_request->setLotWithdrawAmount($this->lot1b->getID(), 3);
//And it should be possible to get the amount via the lot object or via the ID
- $this->assertEquals(2, $build_request->getLotWithdrawAmount($this->lot1a->getID()));
- $this->assertEquals(3, $build_request->getLotWithdrawAmount($this->lot1b));
+ $this->assertSame(2, $build_request->getLotWithdrawAmount($this->lot1a->getID()));
+ $this->assertSame(3, $build_request->getLotWithdrawAmount($this->lot1b));
}
public function testGetWithdrawAmountSum(): void
@@ -166,9 +166,9 @@ class ProjectBuildRequestTest extends TestCase
$build_request->setLotWithdrawAmount($this->lot1a, 2);
$build_request->setLotWithdrawAmount($this->lot1b, 3);
- $this->assertEquals(5, $build_request->getWithdrawAmountSum($this->bom_entry1a));
+ $this->assertSame(5, $build_request->getWithdrawAmountSum($this->bom_entry1a));
$build_request->setLotWithdrawAmount($this->lot2, 1.5);
- $this->assertEquals(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b));
+ $this->assertSame(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b));
}
diff --git a/tests/Security/SamlUserFactoryTest.php b/tests/Security/SamlUserFactoryTest.php
index 57031c5d..663b8627 100644
--- a/tests/Security/SamlUserFactoryTest.php
+++ b/tests/Security/SamlUserFactoryTest.php
@@ -47,7 +47,7 @@ class SamlUserFactoryTest extends WebTestCase
$this->assertInstanceOf(User::class, $user);
- $this->assertEquals('sso_user', $user->getUserIdentifier());
+ $this->assertSame('sso_user', $user->getUserIdentifier());
//User must not change his password
$this->assertFalse($user->isNeedPwChange());
//And must not be disabled
@@ -56,10 +56,10 @@ class SamlUserFactoryTest extends WebTestCase
$this->assertSame('!!SAML!!', $user->getPassword());
//Info should be set
- $this->assertEquals('John', $user->getFirstName());
- $this->assertEquals('Doe', $user->getLastName());
- $this->assertEquals('IT', $user->getDepartment());
- $this->assertEquals('j.doe@invalid.invalid', $user->getEmail());
+ $this->assertSame('John', $user->getFirstName());
+ $this->assertSame('Doe', $user->getLastName());
+ $this->assertSame('IT', $user->getDepartment());
+ $this->assertSame('j.doe@invalid.invalid', $user->getEmail());
}
public function testMapSAMLRolesToLocalGroupID(): void
@@ -80,10 +80,10 @@ class SamlUserFactoryTest extends WebTestCase
$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
- $this->assertEquals(4, $this->service->mapSAMLRolesToLocalGroupID(['ADMIN'], $mapping));
+ $this->assertSame(4, $this->service->mapSAMLRolesToLocalGroupID(['ADMIN'], $mapping));
//Test that wildcard mapping works
- $this->assertEquals(4, $this->service->mapSAMLRolesToLocalGroupID(['entry1', 'entry2'], $mapping));
- $this->assertEquals(4, $this->service->mapSAMLRolesToLocalGroupID([], $mapping));
+ $this->assertSame(4, $this->service->mapSAMLRolesToLocalGroupID(['entry1', 'entry2'], $mapping));
+ $this->assertSame(4, $this->service->mapSAMLRolesToLocalGroupID([], $mapping));
}
}
diff --git a/tests/Services/Attachments/AttachmentURLGeneratorTest.php b/tests/Services/Attachments/AttachmentURLGeneratorTest.php
index 9fac356f..0db57f29 100644
--- a/tests/Services/Attachments/AttachmentURLGeneratorTest.php
+++ b/tests/Services/Attachments/AttachmentURLGeneratorTest.php
@@ -38,15 +38,13 @@ class AttachmentURLGeneratorTest extends WebTestCase
self::$service = self::getContainer()->get(AttachmentURLGenerator::class);
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- ['/public/test.jpg', 'test.jpg'],
- ['/public/folder/test.jpg', 'folder/test.jpg'],
- ['/not/public/test.jpg', null],
- ['/public/', ''],
- ['not/absolute/test.jpg', null],
- ];
+ yield ['/public/test.jpg', 'test.jpg'];
+ yield ['/public/folder/test.jpg', 'folder/test.jpg'];
+ yield ['/not/public/test.jpg', null];
+ yield ['/public/', ''];
+ yield ['not/absolute/test.jpg', null];
}
/**
diff --git a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php
index 2ba317ed..5ca656e3 100644
--- a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php
+++ b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php
@@ -43,20 +43,15 @@ class BuiltinAttachmentsFinderTest extends WebTestCase
self::$service = self::getContainer()->get(BuiltinAttachmentsFinder::class);
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- //No value should return empty array
- ['', [], []],
- ['', ['empty_returns_all' => true], static::$mock_list],
- //Basic search for keyword
- ['test', [], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS_3D%/test.jpg']],
- ['%FOOTPRINTS_3D%', [], ['%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt']],
- ['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']],
- //Filter extensions
- //['test', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/123.jpeg', '%FOOTPRINTS_3D%/test.jpg']],
- //['test.jpg', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS_3D%/test.jpg']]
- ];
+ //No value should return empty array
+ yield ['', [], []];
+ yield ['', ['empty_returns_all' => true], static::$mock_list];
+ //Basic search for keyword
+ yield ['test', [], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS_3D%/test.jpg']];
+ yield ['%FOOTPRINTS_3D%', [], ['%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt']];
+ yield ['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']];
}
/**
diff --git a/tests/Services/ImportExportSystem/BOMImporterTest.php b/tests/Services/ImportExportSystem/BOMImporterTest.php
index 194e23f1..1ccb8275 100644
--- a/tests/Services/ImportExportSystem/BOMImporterTest.php
+++ b/tests/Services/ImportExportSystem/BOMImporterTest.php
@@ -81,8 +81,8 @@ class BOMImporterTest extends WebTestCase
$this->assertContainsOnlyInstancesOf(ProjectBOMEntry::class, $bom);
$this->assertCount(4, $bom);
- $this->assertEquals('R19,R17', $bom[0]->getMountnames());
- $this->assertEquals(2.0, $bom[0]->getQuantity());
+ $this->assertSame('R19,R17', $bom[0]->getMountnames());
+ $this->assertSame(2.0, $bom[0]->getQuantity());
$this->assertSame('4.7k (R_0805_2012Metric_Pad1.20x1.40mm_HandSolder)', $bom[0]->getName());
$this->assertSame('Test', $bom[0]->getComment());
@@ -100,8 +100,8 @@ class BOMImporterTest extends WebTestCase
$this->assertContainsOnlyInstancesOf(ProjectBOMEntry::class, $bom);
$this->assertCount(4, $bom);
- $this->assertEquals('R19,R17', $bom[0]->getMountnames());
- $this->assertEquals(2.0, $bom[0]->getQuantity());
+ $this->assertSame('R19,R17', $bom[0]->getMountnames());
+ $this->assertSame(2.0, $bom[0]->getQuantity());
$this->assertSame('4.7k (R_0805_2012Metric_Pad1.20x1.40mm_HandSolder)', $bom[0]->getName());
$this->assertSame('Test', $bom[0]->getComment());
}
diff --git a/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php b/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php
index c1a8ea11..45b50389 100644
--- a/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php
+++ b/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php
@@ -57,33 +57,31 @@ class BarcodeNormalizerTest extends WebTestCase
$this->service = self::getContainer()->get(BarcodeNormalizer::class);
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- //QR URL content:
- [['lot', 1], 'https://localhost:8000/scan/lot/1'],
- [['part', 123], 'https://localhost:8000/scan/part/123'],
- [['location', 4], 'http://foo.bar/part-db/scan/location/4'],
- [['under_score', 10], 'http://test/part-db/sub/scan/under_score/10/'],
- //Current Code39 format:
- [['lot', 10], 'L0010'],
- [['lot', 123], 'L0123'],
- [['lot', 123456], 'L123456'],
- [['part', 2], 'P0002'],
- //Development phase Code39 barcodes:
- [['lot', 10], 'L-000010'],
- [['lot', 10], 'Lß000010'],
- [['part', 123], 'P-000123'],
- [['location', 123], 'S-000123'],
- [['lot', 12_345_678], 'L-12345678'],
- //Legacy storelocation format
- [['location', 336], '$L00336'],
- [['location', 12_345_678], '$L12345678'],
- //Legacy Part format
- [['part', 123], '0000123'],
- [['part', 123], '00001236'],
- [['part', 1_234_567], '12345678'],
- ];
+ //QR URL content:
+ yield [['lot', 1], 'https://localhost:8000/scan/lot/1'];
+ yield [['part', 123], 'https://localhost:8000/scan/part/123'];
+ yield [['location', 4], 'http://foo.bar/part-db/scan/location/4'];
+ yield [['under_score', 10], 'http://test/part-db/sub/scan/under_score/10/'];
+ //Current Code39 format:
+ yield [['lot', 10], 'L0010'];
+ yield [['lot', 123], 'L0123'];
+ yield [['lot', 123456], 'L123456'];
+ yield [['part', 2], 'P0002'];
+ //Development phase Code39 barcodes:
+ yield [['lot', 10], 'L-000010'];
+ yield [['lot', 10], 'Lß000010'];
+ yield [['part', 123], 'P-000123'];
+ yield [['location', 123], 'S-000123'];
+ yield [['lot', 12_345_678], 'L-12345678'];
+ //Legacy storelocation format
+ yield [['location', 336], '$L00336'];
+ yield [['location', 12_345_678], '$L12345678'];
+ //Legacy Part format
+ yield [['part', 123], '0000123'];
+ yield [['part', 123], '00001236'];
+ yield [['part', 1_234_567], '12345678'];
}
public function invalidDataProvider(): array
diff --git a/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php
index ee32ca94..3c40a9ac 100644
--- a/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php
+++ b/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php
@@ -63,11 +63,9 @@ class AbstractElementProviderTest extends WebTestCase
};
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- ['123', '[[ID]]'],
- ];
+ yield ['123', '[[ID]]'];
}
/**
diff --git a/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php b/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php
index 3a66aa87..854e7467 100644
--- a/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php
+++ b/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php
@@ -61,12 +61,10 @@ class GlobalProvidersTest extends WebTestCase
$this->target = new Part();
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- ['Part-DB', '[[INSTALL_NAME]]'],
- ['anonymous', '[[USERNAME]]'],
- ];
+ yield ['Part-DB', '[[INSTALL_NAME]]'];
+ yield ['anonymous', '[[USERNAME]]'];
}
/**
diff --git a/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php
index e5644515..7360b2d2 100644
--- a/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php
+++ b/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php
@@ -66,11 +66,9 @@ class NamedElementProviderTest extends WebTestCase
};
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- ['This is my Name', '[[NAME]]'],
- ];
+ yield ['This is my Name', '[[NAME]]'];
}
/**
diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php
index 83d7f3d9..537c6223 100644
--- a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php
+++ b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php
@@ -85,22 +85,20 @@ class PartLotProviderTest extends WebTestCase
$this->target->setOwner($user);
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- ['unknown', '[[LOT_ID]]'],
- ['Lot description', '[[LOT_NAME]]'],
- ['Lot comment', '[[LOT_COMMENT]]'],
- ['4/13/99', '[[EXPIRATION_DATE]]'],
- ['?', '[[AMOUNT]]'],
- ['Location', '[[LOCATION]]'],
- ['Parent → Location', '[[LOCATION_FULL]]'],
- //Test part inheritance
- ['Part', '[[NAME]]'],
- ['Part description', '[[DESCRIPTION]]'],
- ['John Doe', '[[OWNER]]'],
- ['user', '[[OWNER_USERNAME]]'],
- ];
+ yield ['unknown', '[[LOT_ID]]'];
+ yield ['Lot description', '[[LOT_NAME]]'];
+ yield ['Lot comment', '[[LOT_COMMENT]]'];
+ yield ['4/13/99', '[[EXPIRATION_DATE]]'];
+ yield ['?', '[[AMOUNT]]'];
+ yield ['Location', '[[LOCATION]]'];
+ yield ['Parent → Location', '[[LOCATION_FULL]]'];
+ //Test part inheritance
+ yield ['Part', '[[NAME]]'];
+ yield ['Part description', '[[DESCRIPTION]]'];
+ yield ['John Doe', '[[OWNER]]'];
+ yield ['user', '[[OWNER_USERNAME]]'];
}
/**
diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php
index 51584edc..975a5fd5 100644
--- a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php
+++ b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php
@@ -86,25 +86,22 @@ class PartProviderTest extends WebTestCase
$this->target->setComment('Bold *Italic*');
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- ['Node 2.1', '[[CATEGORY]]'],
- ['Node 2 → Node 2.1', '[[CATEGORY_FULL]]'],
- ['Node 2.1', '[[FOOTPRINT]]'],
- ['Node 2 → Node 2.1', '[[FOOTPRINT_FULL]]'],
- ['', '[[MANUFACTURER]]'],
- ['', '[[MANUFACTURER_FULL]]'],
-
- ['1.2 kg', '[[MASS]]'],
- ['MPN123', '[[MPN]]'],
- ['SMD, Tag1, Tag2', '[[TAGS]]'],
- ['Active', '[[M_STATUS]]'],
- ['Bold Italic', '[[DESCRIPTION]]'],
- ['Bold Italic', '[[DESCRIPTION_T]]'],
- ['Bold Italic', '[[COMMENT]]'],
- ['Bold Italic', '[[COMMENT_T]]'],
- ];
+ yield ['Node 2.1', '[[CATEGORY]]'];
+ yield ['Node 2 → Node 2.1', '[[CATEGORY_FULL]]'];
+ yield ['Node 2.1', '[[FOOTPRINT]]'];
+ yield ['Node 2 → Node 2.1', '[[FOOTPRINT_FULL]]'];
+ yield ['', '[[MANUFACTURER]]'];
+ yield ['', '[[MANUFACTURER_FULL]]'];
+ yield ['1.2 kg', '[[MASS]]'];
+ yield ['MPN123', '[[MPN]]'];
+ yield ['SMD, Tag1, Tag2', '[[TAGS]]'];
+ yield ['Active', '[[M_STATUS]]'];
+ yield ['Bold Italic', '[[DESCRIPTION]]'];
+ yield ['Bold Italic', '[[DESCRIPTION_T]]'];
+ yield ['Bold Italic', '[[COMMENT]]'];
+ yield ['Bold Italic', '[[COMMENT_T]]'];
}
/**
diff --git a/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php
index 79b9a95f..07bb4270 100644
--- a/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php
+++ b/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php
@@ -74,14 +74,11 @@ class TimestampableElementProviderTest extends WebTestCase
};
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
\Locale::setDefault('en');
-
- return [
- ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]'],
- ['1/1/00, 12:00 AM', '[[CREATION_DATE]]'],
- ];
+ yield ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]'];
+ yield ['1/1/00, 12:00 AM', '[[CREATION_DATE]]'];
}
/**
diff --git a/tests/Services/Misc/RangeParserTest.php b/tests/Services/Misc/RangeParserTest.php
index 2ffa5f04..27f45e98 100644
--- a/tests/Services/Misc/RangeParserTest.php
+++ b/tests/Services/Misc/RangeParserTest.php
@@ -57,30 +57,28 @@ class RangeParserTest extends WebTestCase
$this->service = self::getContainer()->get(RangeParser::class);
}
- public function dataProvider(): array
+ public function dataProvider(): \Iterator
{
- return [
- [[], ''],
- [[], ' '],
- [[], "\t"],
- [[1], '1'],
- [[1, 2, 3], '1,2, 3'],
- [[1, 2, 3], '1-3'],
- [[1, 2, 3, 4], '1- 3, 4'],
- [[1, 2, 3, 4], '1, 2,3 - 4'],
- [[1, 2, 3], ' 1; 2, 3'],
- [[-1, 0, 1, 2], '-1; 0; 1, 2'],
- [[4, 3, 1, 2], '4,3, 1;2'],
- [[1, 2, 3, 4], '2-1, 3-4'],
- [[1], '1-1'],
- [[-3, -2, -1], '-3--1'],
- [[1, 2, 3], '1,,2;;,,3'],
- [[100, 1000, 1], '100, 1000, 1'],
- [[], 'test', true],
- [[], '1-2-3-4,5', true],
- [[], '1 2 3, 455, 23', true],
- [[], '1, 2, test', true],
- ];
+ yield [[], ''];
+ yield [[], ' '];
+ yield [[], "\t"];
+ yield [[1], '1'];
+ yield [[1, 2, 3], '1,2, 3'];
+ yield [[1, 2, 3], '1-3'];
+ yield [[1, 2, 3, 4], '1- 3, 4'];
+ yield [[1, 2, 3, 4], '1, 2,3 - 4'];
+ yield [[1, 2, 3], ' 1; 2, 3'];
+ yield [[-1, 0, 1, 2], '-1; 0; 1, 2'];
+ yield [[4, 3, 1, 2], '4,3, 1;2'];
+ yield [[1, 2, 3, 4], '2-1, 3-4'];
+ yield [[1], '1-1'];
+ yield [[-3, -2, -1], '-3--1'];
+ yield [[1, 2, 3], '1,,2;;,,3'];
+ yield [[100, 1000, 1], '100, 1000, 1'];
+ yield [[], 'test', true];
+ yield [[], '1-2-3-4,5', true];
+ yield [[], '1 2 3, 455, 23', true];
+ yield [[], '1, 2, test', true];
}
public function validDataProvider(): array
diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php
index e3f76785..090ccdfb 100644
--- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php
+++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php
@@ -117,15 +117,15 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
{
//Add 5 to lot 1
$this->service->add($this->partLot1, 5, "Test");
- $this->assertEquals(15, $this->partLot1->getAmount());
+ $this->assertSame(15, $this->partLot1->getAmount());
//Add 3.2 to lot 2
$this->service->add($this->partLot2, 3.2, "Test");
- $this->assertEquals(5, $this->partLot2->getAmount());
+ $this->assertSame(5, $this->partLot2->getAmount());
//Add 1.5 to lot 3
$this->service->add($this->partLot3, 1.5, "Test");
- $this->assertEquals(2, $this->partLot3->getAmount());
+ $this->assertSame(2, $this->partLot3->getAmount());
}
@@ -133,23 +133,23 @@ class PartLotWithdrawAddHelperTest extends WebTestCase
{
//Withdraw 5 from lot 1
$this->service->withdraw($this->partLot1, 5, "Test");
- $this->assertEquals(5, $this->partLot1->getAmount());
+ $this->assertSame(5, $this->partLot1->getAmount());
//Withdraw 2.2 from lot 2
$this->service->withdraw($this->partLot2, 2.2, "Test");
- $this->assertEquals(0, $this->partLot2->getAmount());
+ $this->assertSame(0, $this->partLot2->getAmount());
}
public function testMove(): void
{
//Move 5 from lot 1 to lot 2
$this->service->move($this->partLot1, $this->partLot2, 5, "Test");
- $this->assertEquals(5, $this->partLot1->getAmount());
- $this->assertEquals(7, $this->partLot2->getAmount());
+ $this->assertSame(5, $this->partLot1->getAmount());
+ $this->assertSame(7, $this->partLot2->getAmount());
//Move 2.2 from lot 2 to lot 3
$this->service->move($this->partLot2, $this->partLot3, 2.2, "Test");
- $this->assertEquals(5, $this->partLot2->getAmount());
- $this->assertEquals(2, $this->partLot3->getAmount());
+ $this->assertSame(5, $this->partLot2->getAmount());
+ $this->assertSame(2, $this->partLot3->getAmount());
}
}
diff --git a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php
index ef249deb..71a0c999 100644
--- a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php
+++ b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php
@@ -65,12 +65,12 @@ class ProjectBuildHelperTest extends WebTestCase
$project_bom_entry->setPart($part);
//We have 125 parts in stock, so we can build 12 times the project (125 / 10 = 12.5)
- $this->assertEquals(12, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry));
+ $this->assertSame(12, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry));
$lot1->setAmount(0);
//We have 5 parts in stock, so we can build 0 times the project (5 / 10 = 0.5)
- $this->assertEquals(0, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry));
+ $this->assertSame(0, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry));
}
public function testGetMaximumBuildableCount(): void
@@ -101,15 +101,15 @@ class ProjectBuildHelperTest extends WebTestCase
$project->addBomEntry((new ProjectBOMEntry())->setName('Non part entry')->setQuantity(1));
//Restricted by the few parts in stock of part2
- $this->assertEquals(2, $this->service->getMaximumBuildableCount($project));
+ $this->assertSame(2, $this->service->getMaximumBuildableCount($project));
$lot3->setAmount(1000);
//Now the build count is restricted by the few parts in stock of part1
- $this->assertEquals(12, $this->service->getMaximumBuildableCount($project));
+ $this->assertSame(12, $this->service->getMaximumBuildableCount($project));
$lot3->setAmount(0);
//Now the build count must be 0, as we have no parts in stock
- $this->assertEquals(0, $this->service->getMaximumBuildableCount($project));
+ $this->assertSame(0, $this->service->getMaximumBuildableCount($project));
}
}
diff --git a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php
index 249c8f46..82376298 100644
--- a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php
+++ b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php
@@ -73,7 +73,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase
//With schema version 0, an update should be done and the schema version should be updated
self::assertTrue($this->service->upgradeSchema($user));
- self::assertEquals(PermissionData::CURRENT_SCHEMA_VERSION, $user->getPermissions()->getSchemaVersion());
+ self::assertSame(PermissionData::CURRENT_SCHEMA_VERSION, $user->getPermissions()->getSchemaVersion());
//If we redo it with the same schema version, no update should be done
self::assertFalse($this->service->upgradeSchema($user));
diff --git a/tests/Twig/EntityExtensionTest.php b/tests/Twig/EntityExtensionTest.php
index 99ad8428..530047ef 100644
--- a/tests/Twig/EntityExtensionTest.php
+++ b/tests/Twig/EntityExtensionTest.php
@@ -52,19 +52,19 @@ class EntityExtensionTest extends WebTestCase
public function testGetEntityType(): void
{
- $this->assertEquals('part', $this->service->getEntityType(new Part()));
- $this->assertEquals('footprint', $this->service->getEntityType(new Footprint()));
- $this->assertEquals('storelocation', $this->service->getEntityType(new Storelocation()));
- $this->assertEquals('manufacturer', $this->service->getEntityType(new Manufacturer()));
- $this->assertEquals('category', $this->service->getEntityType(new Category()));
- $this->assertEquals('device', $this->service->getEntityType(new Project()));
- $this->assertEquals('attachment', $this->service->getEntityType(new PartAttachment()));
- $this->assertEquals('supplier', $this->service->getEntityType(new Supplier()));
- $this->assertEquals('user', $this->service->getEntityType(new User()));
- $this->assertEquals('group', $this->service->getEntityType(new Group()));
- $this->assertEquals('currency', $this->service->getEntityType(new Currency()));
- $this->assertEquals('measurement_unit', $this->service->getEntityType(new MeasurementUnit()));
- $this->assertEquals('label_profile', $this->service->getEntityType(new LabelProfile()));
+ $this->assertSame('part', $this->service->getEntityType(new Part()));
+ $this->assertSame('footprint', $this->service->getEntityType(new Footprint()));
+ $this->assertSame('storelocation', $this->service->getEntityType(new Storelocation()));
+ $this->assertSame('manufacturer', $this->service->getEntityType(new Manufacturer()));
+ $this->assertSame('category', $this->service->getEntityType(new Category()));
+ $this->assertSame('device', $this->service->getEntityType(new Project()));
+ $this->assertSame('attachment', $this->service->getEntityType(new PartAttachment()));
+ $this->assertSame('supplier', $this->service->getEntityType(new Supplier()));
+ $this->assertSame('user', $this->service->getEntityType(new User()));
+ $this->assertSame('group', $this->service->getEntityType(new Group()));
+ $this->assertSame('currency', $this->service->getEntityType(new Currency()));
+ $this->assertSame('measurement_unit', $this->service->getEntityType(new MeasurementUnit()));
+ $this->assertSame('label_profile', $this->service->getEntityType(new LabelProfile()));
}
}
diff --git a/tests/Twig/UserExtensionTest.php b/tests/Twig/UserExtensionTest.php
index 1fa722f6..e818f447 100644
--- a/tests/Twig/UserExtensionTest.php
+++ b/tests/Twig/UserExtensionTest.php
@@ -47,7 +47,7 @@ class UserExtensionTest extends WebTestCase
*/
public function testRemoveLocaleFromPath(string $expected, string $input): void
{
- $this->assertEquals($expected, $this->service->removeLocaleFromPath($input));
+ $this->assertSame($expected, $this->service->removeLocaleFromPath($input));
}
public function testRemoveLocaleFromPathException(): void