Skip to content

Commit 9fde4bf

Browse files
committed
Remove unused exception and add a new testcase covering using the same id more then once
1 parent 6b073cc commit 9fde4bf

2 files changed

Lines changed: 26 additions & 23 deletions

File tree

src/Metadata/MultipleDataSubjectId.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/Unit/Metadata/AttributeMetadataFactoryTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,32 @@ public function __construct(
448448
self::assertSame('bar', $barNameProperty->personalDataIdentifier());
449449
}
450450

451+
public function testDuplicateSubjectIdIdentifiers(): void
452+
{
453+
$event = new class ('fooId', 'fooName', 'barId', 'barName') {
454+
public function __construct(
455+
#[DataSubjectId(identifier: 'foo')]
456+
#[NormalizedName('_fooId')]
457+
public string $fooId,
458+
#[PersonalData('fallback', identifier: 'foo')]
459+
#[NormalizedName('_fooName')]
460+
public string $fooName,
461+
#[DataSubjectId(identifier: 'foo')]
462+
#[NormalizedName('_barId')]
463+
public string $barId,
464+
#[PersonalData('fallback', identifier: 'foo')]
465+
#[NormalizedName('_barName')]
466+
public string $barName,
467+
) {
468+
}
469+
};
470+
471+
$metadataFactory = new AttributeMetadataFactory();
472+
473+
$this->expectException(DuplicateSubjectIdIdentifier::class);
474+
$metadataFactory->metadata($event::class);
475+
}
476+
451477
public function testExtendsWithPersonalData(): void
452478
{
453479
$metadataFactory = new AttributeMetadataFactory();

0 commit comments

Comments
 (0)