diff --git a/tests/Properties/ComputedPropertyExtensionTest.php b/tests/Properties/ComputedPropertyExtensionTest.php index 2fe5887..d81b49c 100644 --- a/tests/Properties/ComputedPropertyExtensionTest.php +++ b/tests/Properties/ComputedPropertyExtensionTest.php @@ -63,6 +63,24 @@ public function itRegistersComputedProperyForGetterStyle(): void )); } + #[Test] + public function itRegistersComputedProperiesFromTraits(): void + { + $properties = [ + 'trait_method', + 'traitMethod', + 'trait_getter', + 'traitGetter', + ]; + + foreach ($properties as $property) { + $this->assertTrue($this->reflectionExtension->hasProperty( + $this->classReflection, + $property, + )); + } + } + #[Test] public function itCanFindSnakeCaseProperties(): void { diff --git a/tests/stubs/TestComponentWithComputedProperties.php b/tests/stubs/TestComponentWithComputedProperties.php index 00d2658..4d2ccc2 100644 --- a/tests/stubs/TestComponentWithComputedProperties.php +++ b/tests/stubs/TestComponentWithComputedProperties.php @@ -9,6 +9,8 @@ final class TestComponentWithComputedProperties extends Component { + use TraitWithComputedProperties; + public function notAComputedProperty(): bool { return true; diff --git a/tests/stubs/TraitWithComputedProperties.php b/tests/stubs/TraitWithComputedProperties.php new file mode 100644 index 0000000..fac3118 --- /dev/null +++ b/tests/stubs/TraitWithComputedProperties.php @@ -0,0 +1,21 @@ +