phpstan level 8 preparation

This commit is contained in:
Spine
2025-07-28 16:55:16 +02:00
parent 889766f032
commit 3e9b2bcb4f
37 changed files with 560 additions and 330 deletions
+51 -37
View File
@@ -24,7 +24,7 @@ class ManagerReportAutoTest extends TestCase {
$raMan = new Manager\ReportAuto();
$type = $ratMan->create('raman test create type' . randomString(6), 'description', 'ReportAutoTest');
$report = $raMan->create($this->user1, $type, ['a' => 'b']);
$this->assertGreaterThan(0, $report->id(), 'raman-create-id');
$this->assertGreaterThan(0, $report->id, 'raman-create-id');
$report2 = $raMan->create($this->user1, $type, ['a' => 'b']);
$this->assertNotEquals($report, $report2, 'raman-create-unique');
@@ -32,9 +32,9 @@ class ManagerReportAutoTest extends TestCase {
$report3 = $raMan->create($this->user1, $type, ['c' => 'd'], '2024-01-01T00:00+0');
$this->assertStringStartsWith('2024-01-01 00:00', $report3->created(), 'raman-create-time');
$report3_n = $raMan->findById($report3->id());
$report3_n = $raMan->findById($report3->id);
$this->assertNotNull($report3_n, 'raman-find-id');
$this->assertEquals($report3->id(), $report3_n->id(), 'raman-find-identity');
$this->assertEquals($report3->id, $report3_n->id, 'raman-find-identity');
$this->assertEquals($report3->state(), $report3_n->state(), 'raman-find-identity-status');
$this->assertEquals($report3->typeId(), $report3_n->typeId(), 'raman-find-identity-typeid');
$this->assertEquals($report3->ownerId(), $report3_n->ownerId(), 'raman-find-identity-ownerid');
@@ -46,17 +46,27 @@ class ManagerReportAutoTest extends TestCase {
$raMan = new Manager\ReportAuto();
$type = $ratMan->create('raman test claimall type' . randomString(6), 'description', 'ReportAutoTest');
$type2 = $ratMan->create('raman test claimall type2' . randomString(6), 'description', 'ReportAutoTest');
$this->assertInstanceOf(ReportAuto\Type::class, $type, 'ratman-type-create-1');
$this->assertInstanceOf(ReportAuto\Type::class, $type2, 'ratman-type-create-2');
$r1 = $raMan->create($this->user1, $type, ['a' => 'b']);
$r2 = $raMan->create($this->user1, $type, ['a' => 'b']);
$r3 = $raMan->create($this->user1, $type2, ['a' => 'b']);
$r4 = $raMan->create($this->user2, $type, ['a' => 'b']);
$this->assertInstanceOf(ReportAuto::class, $r1, 'ratman-create-1');
$this->assertInstanceOf(ReportAuto::class, $r2, 'ratman-create-2');
$this->assertInstanceOf(ReportAuto::class, $r3, 'ratman-create-3');
$this->assertInstanceOf(ReportAuto::class, $r4, 'ratman-create-4');
$raMan->claimAll($this->user2, $this->user1->id(), $type->id());
$raMan->claimAll($this->user2, $this->user1->id, $type->id);
$r1n = $raMan->findById($r1->id());
$r2n = $raMan->findById($r2->id());
$r3n = $raMan->findById($r3->id());
$r4n = $raMan->findById($r4->id());
$r1n = $raMan->findById($r1->id);
$r2n = $raMan->findById($r2->id);
$r3n = $raMan->findById($r3->id);
$r4n = $raMan->findById($r4->id);
$this->assertInstanceOf(ReportAuto::class, $r1n, 'ratman-create-n-1');
$this->assertInstanceOf(ReportAuto::class, $r2n, 'ratman-create-n-2');
$this->assertInstanceOf(ReportAuto::class, $r3n, 'ratman-create-n-3');
$this->assertInstanceOf(ReportAuto::class, $r4n, 'ratman-create-n-4');
$this->assertTrue($r1n->isClaimed(), 'raman-claimall-1-1');
$this->assertFalse($r1n->isResolved(), 'raman-claimall-1-2');
$this->assertTrue($r2n->isClaimed(), 'raman-claimall-2-1');
@@ -66,25 +76,29 @@ class ManagerReportAutoTest extends TestCase {
$this->assertFalse($r4n->isClaimed(), 'raman-claimall-4-1');
$this->assertFalse($r4n->isResolved(), 'raman-claimall-4-2');
$raMan->claimAll($this->user1, $this->user1->id(), $type2->id());
$raMan->claimAll($this->user1, $this->user1->id, $type2->id);
$r1n = $raMan->findById($r1->id());
$r2n = $raMan->findById($r2->id());
$r3n = $raMan->findById($r3->id());
$r4n = $raMan->findById($r4->id());
$r1n = $raMan->findById($r1->id);
$r2n = $raMan->findById($r2->id);
$r3n = $raMan->findById($r3->id);
$r4n = $raMan->findById($r4->id);
$this->assertInstanceOf(ReportAuto::class, $r1n, 'ratman-create-n2-1');
$this->assertInstanceOf(ReportAuto::class, $r2n, 'ratman-create-n2-2');
$this->assertInstanceOf(ReportAuto::class, $r3n, 'ratman-create-n2-3');
$this->assertInstanceOf(ReportAuto::class, $r4n, 'ratman-create-n2-4');
$this->assertTrue($r1n->isClaimed(), 'raman-claimall-1-1');
$this->assertTrue($r2n->isClaimed(), 'raman-claimall-2-1');
$this->assertTrue($r3n->isClaimed(), 'raman-claimall-3-1');
$this->assertFalse($r4n->isClaimed(), 'raman-claimall-4-1');
$this->assertEquals($this->user2->id(), $r1n->ownerId(), 'raman-claimall-owner-1');
$this->assertEquals($this->user2->id(), $r2n->ownerId(), 'raman-claimall-owner-2');
$this->assertEquals($this->user1->id(), $r3n->ownerId(), 'raman-claimall-owner-3');
$this->assertEquals($this->user2->id, $r1n->ownerId(), 'raman-claimall-owner-1');
$this->assertEquals($this->user2->id, $r2n->ownerId(), 'raman-claimall-owner-2');
$this->assertEquals($this->user1->id, $r3n->ownerId(), 'raman-claimall-owner-3');
$this->assertEquals(null, $r4n->ownerId(), 'raman-claimall-owner-4');
$raMan->claimAll($this->user2, $this->user2->id(), null);
$r4n = $raMan->findById($r4->id());
$this->assertEquals($this->user2->id(), $r4n->ownerId(), 'raman-claimall-owner-5');
$raMan->claimAll($this->user2, $this->user2->id, null);
$r4n = $raMan->findById($r4->id);
$this->assertEquals($this->user2->id, $r4n->ownerId(), 'raman-claimall-owner-5');
$this->assertTrue($r4n->isClaimed(), 'raman-claimall-4-4');
}
@@ -98,12 +112,12 @@ class ManagerReportAutoTest extends TestCase {
$r3 = $raMan->create($this->user1, $type2, ['a' => 'b']);
$r4 = $raMan->create($this->user2, $type, ['a' => 'b']);
$raMan->resolveAll($this->user2, $this->user1->id(), $type->id());
$raMan->resolveAll($this->user2, $this->user1->id, $type->id);
$r1n = $raMan->findById($r1->id());
$r2n = $raMan->findById($r2->id());
$r3n = $raMan->findById($r3->id());
$r4n = $raMan->findById($r4->id());
$r1n = $raMan->findById($r1->id);
$r2n = $raMan->findById($r2->id);
$r3n = $raMan->findById($r3->id);
$r4n = $raMan->findById($r4->id);
$this->assertTrue($r1n->isClaimed(), 'raman-resolveall-1-1');
$this->assertTrue($r1n->isResolved(), 'raman-resolveall-1-2');
$this->assertTrue($r2n->isClaimed(), 'raman-resolveall-2-1');
@@ -113,25 +127,25 @@ class ManagerReportAutoTest extends TestCase {
$this->assertFalse($r4n->isClaimed(), 'raman-resolveall-4-1');
$this->assertFalse($r4n->isResolved(), 'raman-resolveall-4-2');
$raMan->resolveAll($this->user1, $this->user1->id(), $type2->id());
$raMan->resolveAll($this->user1, $this->user1->id, $type2->id);
$r1n = $raMan->findById($r1->id());
$r2n = $raMan->findById($r2->id());
$r3n = $raMan->findById($r3->id());
$r4n = $raMan->findById($r4->id());
$r1n = $raMan->findById($r1->id);
$r2n = $raMan->findById($r2->id);
$r3n = $raMan->findById($r3->id);
$r4n = $raMan->findById($r4->id);
$this->assertTrue($r1n->isResolved(), 'raman-resolveall-1-3');
$this->assertTrue($r2n->isResolved(), 'raman-resolveall-2-3');
$this->assertTrue($r3n->isResolved(), 'raman-resolveall-3-3');
$this->assertFalse($r4n->isResolved(), 'raman-resolveall-4-3');
$this->assertEquals($this->user2->id(), $r1n->ownerId(), 'raman-resolveall-owner-1');
$this->assertEquals($this->user2->id(), $r2n->ownerId(), 'raman-resolveall-owner-2');
$this->assertEquals($this->user1->id(), $r3n->ownerId(), 'raman-resolveall-owner-3');
$this->assertEquals($this->user2->id, $r1n->ownerId(), 'raman-resolveall-owner-1');
$this->assertEquals($this->user2->id, $r2n->ownerId(), 'raman-resolveall-owner-2');
$this->assertEquals($this->user1->id, $r3n->ownerId(), 'raman-resolveall-owner-3');
$this->assertEquals(null, $r4n->ownerId(), 'raman-resolveall-owner-4');
$raMan->resolveAll($this->user2, $this->user2->id(), null);
$r4n = $raMan->findById($r4->id());
$this->assertEquals($this->user2->id(), $r4n->ownerId(), 'raman-resolveall-owner-5');
$raMan->resolveAll($this->user2, $this->user2->id, null);
$r4n = $raMan->findById($r4->id);
$this->assertEquals($this->user2->id, $r4n->ownerId(), 'raman-resolveall-owner-5');
$this->assertTrue($r4n->isResolved(), 'raman-resolveall-4-4');
}
@@ -144,7 +158,7 @@ class ManagerReportAutoTest extends TestCase {
$this->assertTrue($r->hasComments(), 'raman-delcomment-1');
$this->assertLessThan(1, $raMan->deleteComment($commentId, $this->user2), 'raman-delcomment-2');
$raMan->deleteComment($commentId, $this->user1);
$r = $raMan->findById($r->id());
$r = $raMan->findById($r->id);
$this->assertFalse($r->hasComments(), 'raman-delcomment-3');
}
@@ -157,7 +171,7 @@ class ManagerReportAutoTest extends TestCase {
$this->assertLessThan(1, $raMan->editComment($commentId, $this->user2, "nomessage"), 'raman-editcomment-1');
$this->assertEquals("testcomment", $r->comments()[0]['comment'], 'raman-editcomment-2');
$this->assertEquals(1, $raMan->editComment($commentId, $this->user1, "newmessage"), 'raman-editcomment-3');
$r = $raMan->findById($r->id());
$r = $raMan->findById($r->id);
$this->assertEquals("newmessage", $r->comments()[0]['comment'], 'raman-editcomment-4');
}
}