Skip to content

Commit 0c4f14e

Browse files
committed
docs: rename testing doc to lowercase and update references
- Rename docs/TESTING.md to docs/testing.md (lowercase convention) - Remove all Integration test references (not implemented) - Update README.md links and test suite documentation - Add testing achievements to CHANGELOG.md: - 128 comprehensive tests (103 Unit + 25 Functional) - 85%+ code coverage with PCOV - Test environment configuration - HTTP method restrictions for security - CI/CD with automated testing
1 parent 1560499 commit 0c4f14e

File tree

3 files changed

+21
-45
lines changed

3 files changed

+21
-45
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- **PHPUnit Test Suite**:
12+
- 128 comprehensive tests (103 Unit + 25 Functional)
13+
- 85%+ code coverage with PCOV (faster than Xdebug)
14+
- Test environment configuration for Symfony
15+
- Test fixtures and factories for reusable test data
16+
- Testing documentation in `docs/testing.md`
1117
- **Comprehensive CI/CD Pipeline**:
1218
- **CI Workflow**: Automated testing, code style checks, and frontend build validation
1319
- PHPUnit tests for PHP 8.4
@@ -51,6 +57,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5157
- Supports customization via inputs (node-version)
5258

5359
### Changed
60+
- **Testing Infrastructure**:
61+
- Enabled PHPUnit tests in CI workflow (previously disabled)
62+
- Migrated from Xdebug to PCOV for 10x faster coverage generation
63+
- Excluded non-testable components (CLI Commands, ElasticsearchService) from coverage metrics
64+
- Coverage calculation uses line coverage (industry standard)
65+
- Frontend assets built before tests to support Functional tests
5466
- **Workflow Triggers**: Enhanced workflow execution triggers to run on feature branches
5567
- All workflows now trigger on `main`, `develop`, `feature/**`, and `claude/**` branches
5668
- Enables CI/CD testing during feature development before PR creation
@@ -69,6 +81,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6981
- Improved readability: Focus on business logic vs boilerplate
7082

7183
### Security
84+
- **HTTP Method Restrictions**: Added explicit GET-only methods to controller routes (prevents CSRF attacks)
7285
- **Pinned GitHub Actions to SHA**: All workflow actions now use commit SHA instead of tags for supply chain attack prevention
7386
- `actions/[email protected]` → SHA `71cf2267d89c5cb81562390fa70a37fa40b1305e`
7487
- `shivammathur/[email protected]` → SHA `c541c155eee45413f5b09a52248675b1a2575231`

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ docker compose exec php vendor/bin/php-cs-fixer fix
187187

188188
## Testing
189189

190-
Comprehensive test suite with 85%+ code coverage. See **[Testing Guide](docs/TESTING.md)** for detailed documentation.
190+
Comprehensive test suite with 85%+ code coverage. See **[Testing Guide](docs/testing.md)** for detailed documentation.
191191

192192
**Quick Start:**
193193

@@ -197,7 +197,6 @@ Comprehensive test suite with 85%+ code coverage. See **[Testing Guide](docs/TES
197197

198198
# Run specific suites
199199
./vendor/bin/phpunit --testsuite=Unit
200-
./vendor/bin/phpunit --testsuite=Integration
201200
./vendor/bin/phpunit --testsuite=Functional
202201

203202
# Generate coverage report
@@ -206,10 +205,9 @@ Comprehensive test suite with 85%+ code coverage. See **[Testing Guide](docs/TES
206205

207206
**Test Suites:**
208207
- **Unit Tests**: Isolated component tests (103 tests)
209-
- **Integration Tests**: Tests with real dependencies
210-
- **Functional Tests**: HTTP endpoint tests
208+
- **Functional Tests**: HTTP endpoint tests (25 tests)
211209

212-
For more information, see [docs/TESTING.md](docs/TESTING.md).
210+
For more information, see [docs/testing.md](docs/testing.md).
213211

214212
## Elasticsearch
215213
1. Check cluster health:

docs/TESTING.md renamed to docs/testing.md

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Comprehensive testing suite for PDF Content Search application using PHPUnit.
1010

1111
# Run specific test suites
1212
./vendor/bin/phpunit --testsuite=Unit
13-
./vendor/bin/phpunit --testsuite=Integration
1413
./vendor/bin/phpunit --testsuite=Functional
1514

1615
# Run with coverage
@@ -49,9 +48,6 @@ tests/
4948
│ ├── Search/ # Query parsing and building logic
5049
│ ├── Service/ # Service layer tests
5150
│ └── Shared/ # Shared traits and utilities
52-
├── Integration/ # Tests with real dependencies (Elasticsearch, DB)
53-
│ ├── Command/ # Console command tests
54-
│ └── Service/ # Service integration tests
5551
├── Functional/ # HTTP endpoint tests
5652
│ └── Controller/ # Controller action tests
5753
└── Fixtures/ # Test data factories and helpers
@@ -136,7 +132,7 @@ final class QueryParserTest extends TestCase
136132

137133
- **Environment**: `APP_ENV=test` (`.env.test`)
138134
- **Database**: SQLite in-memory (future use)
139-
- **Elasticsearch**: Mock for unit tests, Docker for integration tests
135+
- **Elasticsearch**: Mocked in all tests
140136

141137
### Environment Variables
142138

@@ -153,34 +149,8 @@ ELASTICSEARCH_INDEX_PDFS=pdf_pages_test
153149
Tests run automatically on:
154150
- Every push to any branch
155151
- Every pull request
156-
- Daily scheduled runs (main branch)
157152

158-
See `.github/workflows/tests.yml` for CI configuration.
159-
160-
## Integration Tests with Elasticsearch
161-
162-
Integration tests requiring Elasticsearch are marked with `@group elasticsearch`:
163-
164-
```bash
165-
# Skip Elasticsearch tests
166-
./vendor/bin/phpunit --exclude-group elasticsearch
167-
168-
# Run only Elasticsearch tests
169-
./vendor/bin/phpunit --group elasticsearch
170-
```
171-
172-
**Docker Setup for Integration Tests**:
173-
174-
```bash
175-
# Start test Elasticsearch instance
176-
docker-compose -f docker-compose.test.yml up -d elasticsearch-test
177-
178-
# Run integration tests
179-
./vendor/bin/phpunit --testsuite=Integration
180-
181-
# Stop test services
182-
docker-compose -f docker-compose.test.yml down
183-
```
153+
See `.github/workflows/ci.yml` for CI configuration.
184154

185155
## Code Coverage
186156

@@ -243,11 +213,7 @@ final class ServiceTest extends TestCase
243213

244214
### Issue: Elasticsearch Connection Errors
245215

246-
**Solution**: Use mocks for unit tests, skip integration tests without Docker
247-
248-
```bash
249-
./vendor/bin/phpunit --exclude-group elasticsearch
250-
```
216+
**Solution**: All tests use mocks, no real Elasticsearch connection needed
251217

252218
### Issue: Functional Tests Fail (Missing Assets)
253219

@@ -259,7 +225,7 @@ npm run build # or: yarn build
259225

260226
### Issue: PDF Processing Tests
261227

262-
**Solution**: `pdftotext` not required for unit tests (mocked). Install `poppler-utils` for integration tests.
228+
**Solution**: `pdftotext` not required for unit tests (mocked).
263229

264230
## Factories and Fixtures
265231

@@ -281,9 +247,8 @@ $response = SearchResultFactory::create()
281247
## Performance
282248

283249
- **Unit tests**: < 1 second
284-
- **Integration tests**: < 10 seconds
285250
- **Functional tests**: < 5 seconds
286-
- **Full suite**: < 15 seconds
251+
- **Full suite**: < 5 seconds
287252

288253
Slow tests indicate architectural issues requiring refactoring.
289254

0 commit comments

Comments
 (0)