Skip to content

Commit f3ad3c1

Browse files
committed
Run phpunit code quality rector
1 parent f215bd1 commit f3ad3c1

File tree

15 files changed

+67
-71
lines changed

15 files changed

+67
-71
lines changed

rector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
3636
PHPUnitSetList::PHPUNIT_90,
3737
PHPUnitSetList::PHPUNIT_110,
38+
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
39+
40+
3841
])
3942

4043
->withRules([

tests/DataTables/Filters/Constraints/FilterTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function isAggregateFunctionStringDataProvider(): iterable
5252
#[DataProvider('isAggregateFunctionStringDataProvider')]
5353
public function testIsAggregateFunctionString(bool $expected, string $input): void
5454
{
55-
$this->assertEquals($expected, $this->isAggregateFunctionString($input));
55+
$this->assertSame($expected, $this->isAggregateFunctionString($input));
5656
}
5757

5858
}

tests/Entity/Attachments/AttachmentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function testSetExternalPath(): void
231231
//Ensure that changing the external path does reset the internal one
232232
$attachment->setInternalPath('%MEDIA%/foo/bar.txt');
233233
$attachment->setExternalPath('https://example.de');
234-
$this->assertSame(null, $attachment->getInternalPath());
234+
$this->assertNull($attachment->getInternalPath());
235235

236236
//Ensure that setting the same value to the external path again doesn't reset the internal one
237237
$attachment->setExternalPath('https://google.de');

tests/Entity/Parts/PartTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testAddRemovePartLot(): void
4141
$lot = new PartLot();
4242
$part->addPartLot($lot);
4343
$this->assertSame($part, $lot->getPart());
44-
$this->assertSame(1, $part->getPartLots()->count());
44+
$this->assertCount(1, $part->getPartLots());
4545

4646
//Remove element
4747
$part->removePartLot($lot);

tests/Entity/PriceSystem/OrderdetailTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testAddRemovePricdetails(): void
3838
$pricedetail = new Pricedetail();
3939
$orderdetail->addPricedetail($pricedetail);
4040
$this->assertSame($orderdetail, $pricedetail->getOrderdetail());
41-
$this->assertSame(1, $orderdetail->getPricedetails()->count());
41+
$this->assertCount(1, $orderdetail->getPricedetails());
4242

4343
//After removal of the pricedetail, the orderdetail must be empty again
4444
$orderdetail->removePricedetail($pricedetail);

tests/Entity/UserSystem/ApiTokenTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testGetTokenPrefix(): void
3535

3636
public function testGetTypeFromToken(): void
3737
{
38-
$this->assertEquals(ApiTokenType::PERSONAL_ACCESS_TOKEN, ApiTokenType::getTypeFromToken('tcp_123'));
38+
$this->assertSame(ApiTokenType::PERSONAL_ACCESS_TOKEN, ApiTokenType::getTypeFromToken('tcp_123'));
3939
}
4040

4141
public function testGetTypeFromTokenInvalid(): void

tests/Helpers/Projects/ProjectBuildRequestTest.php

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
class ProjectBuildRequestTest extends TestCase
3434
{
3535

36-
/** @var MeasurementUnit $float_unit */
37-
private MeasurementUnit $float_unit;
38-
3936
/** @var Project */
4037
private Project $project1;
4138
/** @var ProjectBOMEntry */
@@ -49,30 +46,25 @@ class ProjectBuildRequestTest extends TestCase
4946
private PartLot $lot1b;
5047
private PartLot $lot2;
5148

52-
/** @var Part */
53-
private Part $part1;
54-
/** @var Part */
55-
private Part $part2;
56-
5749

5850
public function setUp(): void
5951
{
60-
$this->float_unit = new MeasurementUnit();
61-
$this->float_unit->setName('float');
62-
$this->float_unit->setUnit('f');
63-
$this->float_unit->setIsInteger(false);
64-
$this->float_unit->setUseSIPrefix(true);
52+
$float_unit = new MeasurementUnit();
53+
$float_unit->setName('float');
54+
$float_unit->setUnit('f');
55+
$float_unit->setIsInteger(false);
56+
$float_unit->setUseSIPrefix(true);
6557

6658
//Setup some example parts and part lots
67-
$this->part1 = new Part();
68-
$this->part1->setName('Part 1');
59+
$part1 = new Part();
60+
$part1->setName('Part 1');
6961
$this->lot1a = new class extends PartLot {
7062
public function getID(): ?int
7163
{
7264
return 1;
7365
}
7466
};
75-
$this->part1->addPartLot($this->lot1a);
67+
$part1->addPartLot($this->lot1a);
7668
$this->lot1a->setAmount(10);
7769
$this->lot1a->setDescription('Lot 1a');
7870

@@ -82,25 +74,25 @@ public function getID(): ?int
8274
return 2;
8375
}
8476
};
85-
$this->part1->addPartLot($this->lot1b);
77+
$part1->addPartLot($this->lot1b);
8678
$this->lot1b->setAmount(20);
8779
$this->lot1b->setDescription('Lot 1b');
8880

89-
$this->part2 = new Part();
81+
$part2 = new Part();
9082

91-
$this->part2->setName('Part 2');
92-
$this->part2->setPartUnit($this->float_unit);
83+
$part2->setName('Part 2');
84+
$part2->setPartUnit($float_unit);
9385
$this->lot2 = new PartLot();
94-
$this->part2->addPartLot($this->lot2);
86+
$part2->addPartLot($this->lot2);
9587
$this->lot2->setAmount(2.5);
9688
$this->lot2->setDescription('Lot 2');
9789

9890
$this->bom_entry1a = new ProjectBOMEntry();
99-
$this->bom_entry1a->setPart($this->part1);
91+
$this->bom_entry1a->setPart($part1);
10092
$this->bom_entry1a->setQuantity(2);
10193

10294
$this->bom_entry1b = new ProjectBOMEntry();
103-
$this->bom_entry1b->setPart($this->part2);
95+
$this->bom_entry1b->setPart($part2);
10496
$this->bom_entry1b->setQuantity(1.5);
10597

10698
$this->bom_entry1c = new ProjectBOMEntry();

tests/Repository/NamedDBElementRepositoryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
*/
3333
class NamedDBElementRepositoryTest extends WebTestCase
3434
{
35-
private $entityManager;
3635
/**
3736
* @var StructuralDBElementRepository
3837
*/
@@ -42,11 +41,11 @@ protected function setUp(): void
4241
{
4342
$kernel = self::bootKernel();
4443

45-
$this->entityManager = $kernel->getContainer()
44+
$entityManager = $kernel->getContainer()
4645
->get('doctrine')
4746
->getManager();
4847

49-
$this->repo = $this->entityManager->getRepository(User::class);
48+
$this->repo = $entityManager->getRepository(User::class);
5049
}
5150

5251
public function testGetGenericNodeTree(): void

tests/Repository/StructuralDBElementRepositoryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
*/
3333
class StructuralDBElementRepositoryTest extends WebTestCase
3434
{
35-
private $entityManager;
3635
/**
3736
* @var StructuralDBElementRepository
3837
*/
@@ -42,11 +41,11 @@ protected function setUp(): void
4241
{
4342
$kernel = self::bootKernel();
4443

45-
$this->entityManager = $kernel->getContainer()
44+
$entityManager = $kernel->getContainer()
4645
->get('doctrine')
4746
->getManager();
4847

49-
$this->repo = $this->entityManager->getRepository(AttachmentType::class);
48+
$this->repo = $entityManager->getRepository(AttachmentType::class);
5049
}
5150

5251
public function testFindRootNodes(): void

tests/Repository/UserRepositoryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
class UserRepositoryTest extends WebTestCase
3131
{
3232

33-
private $entityManager;
3433
/**
3534
* @var UserRepository
3635
*/
@@ -40,11 +39,11 @@ protected function setUp(): void
4039
{
4140
$kernel = self::bootKernel();
4241

43-
$this->entityManager = $kernel->getContainer()
42+
$entityManager = $kernel->getContainer()
4443
->get('doctrine')
4544
->getManager();
4645

47-
$this->repo = $this->entityManager->getRepository(User::class);
46+
$this->repo = $entityManager->getRepository(User::class);
4847
}
4948

5049

0 commit comments

Comments
 (0)