| 
9 | 9 | use EduardoMarques\DynamoPHP\Metadata\MetadataLoader;  | 
10 | 10 | use EduardoMarques\DynamoPHP\Tests\Unit\Stubs\ClassA;  | 
11 | 11 | use EduardoMarques\DynamoPHP\Tests\Unit\Stubs\EntityA;  | 
 | 12 | +use EduardoMarques\DynamoPHP\Tests\Unit\Stubs\EntityB;  | 
12 | 13 | use PHPUnit\Framework\Attributes\Test;  | 
13 | 14 | use PHPUnit\Framework\TestCase;  | 
14 | 15 | use ReflectionProperty;  | 
@@ -47,6 +48,32 @@ public function itReturnsEntityMetadata(): void  | 
47 | 48 |         $this->assertInstanceOf(Attribute::class, $attributes[1]);  | 
48 | 49 |         $this->assertInstanceOf(Attribute::class, $attributes[2]);  | 
49 | 50 |         $this->assertInstanceOf(Attribute::class, $attributes[3]);  | 
 | 51 | + | 
 | 52 | +        $this->assertNull($propertyAttributes['name']->name);  | 
 | 53 | +        $this->assertSame('createdAt', $propertyAttributes['creationDate']->name);  | 
 | 54 | +    }  | 
 | 55 | + | 
 | 56 | +    #[Test]  | 
 | 57 | +    public function itReturnsEntityMetadataMergedWithParent(): void  | 
 | 58 | +    {  | 
 | 59 | +        $metadata = $this->metadataLoader->getEntityMetadata(EntityB::class);  | 
 | 60 | + | 
 | 61 | +        $this->assertSame('tests', $metadata->getTable());  | 
 | 62 | +        $this->assertSame(['id'], $metadata->getPartitionKey()->getFields());  | 
 | 63 | +        $this->assertSame(['creationDate'], $metadata->getSortKey()?->getFields());  | 
 | 64 | + | 
 | 65 | +        $propertyAttributes = $metadata->getPropertyAttributes();  | 
 | 66 | +        $properties = array_keys($propertyAttributes);  | 
 | 67 | +        $attributes = array_values($propertyAttributes);  | 
 | 68 | + | 
 | 69 | +        $this->assertSame(['id', 'name', 'creationDate', 'cardNumber', 'type'], $properties);  | 
 | 70 | +        $this->assertInstanceOf(Attribute::class, $attributes[0]);  | 
 | 71 | +        $this->assertInstanceOf(Attribute::class, $attributes[1]);  | 
 | 72 | +        $this->assertInstanceOf(Attribute::class, $attributes[2]);  | 
 | 73 | +        $this->assertInstanceOf(Attribute::class, $attributes[3]);  | 
 | 74 | + | 
 | 75 | +        $this->assertSame('fullName', $propertyAttributes['name']->name);  | 
 | 76 | +        $this->assertNull($propertyAttributes['creationDate']->name);  | 
50 | 77 |     }  | 
51 | 78 | 
 
  | 
52 | 79 |     #[Test]  | 
 | 
0 commit comments