Repository navigation
Integration Tests for PHP 8 Attributes DataSource, SinglePropDataSource, PropertyInstantiatingHook
Pre-release
Pre-release
Summary: Integration Tests for PHP 8 Attributes
Date: 2026-01-03
Branch: feat/tests/CoverPhpAttributes
Overview
Added comprehensive integration test coverage for three PHP 8 attributes and created new test documentation.
Changes Made
1. PropertyInstantiatingHook Tests
Location: tests/Integration/Attributes/PropertyInstantiatingHook/
Files Added:
PropertyInstantiatingHookTest.php(7 tests)Fixtures/TrackedEntity.phpFixtures/TrackedEntityDataSource.phpFixtures/MultiHookEntity.phpFixtures/EntityWithExternalHook.phpFixtures/InstantiationTracker.php
Test Coverage:
- Basic hook execution after instantiation
- Hook method tracking
- Multiple hooks with priority
- External service hooks via service locator
- Multiple entity tracking
- Lazy loading combined with hooks
2. SinglePropDataSource Tests
Location: tests/Integration/Attributes/SinglePropDataSource/
Files Added:
SinglePropDataSourceTest.php(8 tests)Fixtures/Product.phpFixtures/ProductDataSource.phpFixtures/Article.phpFixtures/ArticleDataSource.php
Test Coverage:
- Single property lazy loading
- Multiple property loading per entity
- ID parameter passing
- Unknown ID handling
- Property caching
- Multiple entity instances
3. DataSource Tests (Alias)
Location: tests/Integration/Attributes/DataSource/
Files Added:
DataSourceTest.php(8 tests)Fixtures/User.phpFixtures/UserDataSource.phpFixtures/Post.phpFixtures/PostDataSource.php
Test Coverage:
- Same as SinglePropDataSource (verifies alias works identically)
4. Test Documentation
Location: docs/tests/
Files Added:
README.md- Testing documentation overviewINTEGRATION_TESTS.md- Detailed integration testing guide
Content:
- Test organization and structure
- Naming conventions
- Fixture patterns
- Best practices
- Example code
Statistics
| Metric | Value |
|---|---|
| New Test Files | 3 |
| New Fixture Files | 13 |
| New Documentation Files | 2 |
| New Test Cases | 23 |
| Previous Test Count | 321 |
| New Test Count | 344 |
Test Results
PHPUnit 11.5.46
Time: 00:00.233
Tests: 344, Assertions: 811, Skipped: 3
OK
Patterns Used
All tests follow established patterns:
LocalFixtureAutoloadTraitfor fixture autoloading- Fixtures in
Kassko\Sample\<AttributeName>\namespace LoaderRegistry::clear()in tearDownDataMapperProviderInterfacefor portable tests