Skip to content

Commit 446256c

Browse files
jakobwWMDE bot
authored andcommitted
Add GuidGenerator::newStatementId(): StatementGuid
Change-Id: Ib95353da07d38f56df66d3da109904ba04b89063
1 parent 8b0840d commit 446256c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Statement/GuidGenerator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ public function newGuid( EntityId $entityId ) {
3737
return $entityId->getSerialization() . StatementGuid::SEPARATOR . $this->baseGenerator->newGuid();
3838
}
3939

40+
public function newStatementId( EntityId $entityId ): StatementGuid {
41+
return new StatementGuid( $entityId, $this->baseGenerator->newGuid() );
42+
}
43+
4044
}

tests/unit/Statement/GuidGeneratorTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ public function testGetGuid( EntityId $id ) {
2727
$this->assertIsGuidForId( $guidGen->newGuid( $id ), $id );
2828
}
2929

30+
/**
31+
* @dataProvider entityIdProvider
32+
*/
33+
public function testGetStatementId( EntityId $id ) {
34+
$guidGen = new GuidGenerator();
35+
36+
$this->assertIsGuidForId( (string)$guidGen->newStatementId( $id ), $id );
37+
$this->assertIsGuidForId( (string)$guidGen->newStatementId( $id ), $id );
38+
$this->assertIsGuidForId( (string)$guidGen->newStatementId( $id ), $id );
39+
}
40+
3041
public function entityIdProvider() {
3142
$argLists = [];
3243

0 commit comments

Comments
 (0)