This guide is for contributors and developers working on the discogs-bundle itself.
# Unit tests (fast, CI-compatible, no external dependencies)
composer test
# Integration tests (requires Discogs API credentials)
composer test-integration
# All tests together (unit + integration)
composer test-all
# Code coverage (HTML + XML reports)
composer test-coverage# Static analysis (PHPStan Level 8) - Default for Symfony 7.4 / 8.0
composer analyse
# Static analysis with legacy baseline (required for Symfony 6.4 - 7.3)
composer analyse-legacy
# Code style check (Symfony standards)
composer cs
# Auto-fix code style
composer cs-fixIntegration tests are separated from the CI pipeline to prevent:
- 🚫 Rate limiting (429 Too Many Requests)
- 🚫 Flaky builds due to network issues
- 🚫 Dependency on external API availability
- 🚫 Slow build times (2+ minutes vs. 0.4 seconds)
- Unit Tests: Fast, reliable, no external dependencies → CI default
- Integration Tests: Real API calls, rate-limited → Manual execution
- Bundle Focus: Test Symfony integration, service wiring, configuration
- File:
tests/Integration/PublicApiIntegrationTest.php - No credentials required
- Tests public endpoints through Bundle: artists, releases, labels, masters
- Safe for forks and pull requests
- File:
tests/Integration/AuthenticatedApiIntegrationTest.php - Requires environment variables below
- Tests Bundle authentication configuration:
- Level 2: Consumer credentials (search)
- Level 3: Personal token (user data)
- Level 4: OAuth tokens (direct library usage)
To enable authenticated integration tests in CI/CD, add these secrets to your GitHub repository:
| Secret Name | Description | Where to get it |
|---|---|---|
DISCOGS_CONSUMER_KEY |
Your Discogs app consumer key | Discogs Developer Settings |
DISCOGS_CONSUMER_SECRET |
Your Discogs app consumer secret | Discogs Developer Settings |
DISCOGS_PERSONAL_ACCESS_TOKEN |
Your personal access token | Discogs Developer Settings |
# Set environment variables
export DISCOGS_CONSUMER_KEY="your-consumer-key"
export DISCOGS_CONSUMER_SECRET="your-consumer-secret"
export DISCOGS_PERSONAL_ACCESS_TOKEN="your-personal-access-token"
# Run public tests only
vendor/bin/phpunit tests/Integration/PublicApiIntegrationTest.php
# Run authentication tests (requires env vars)
vendor/bin/phpunit tests/Integration/AuthenticatedApiIntegrationTest.php
# Run all integration tests
vendor/bin/phpunit tests/Integration/ --testdox- Public tests are safe for any environment
- Authentication tests will be skipped if secrets are missing
- No credentials are logged or exposed in the test output
- Tests use read-only operations only (no data modification)
- Fork the repository
- Create feature branch (
git checkout -b feature/name) - Make changes with tests
- Run test suite (
composer test-all) - Check code quality (
composer analyse && composer cs) - Commit changes (
git commit -m 'Add feature') - Push to branch (
git push origin feature/name) - Open Pull Request
- PHP Version: ^8.1
- Code Style: Symfony Coding Standards (@Symfony + @Symfony:risky)
- Static Analysis: PHPStan Level 8
- Test Coverage: Comprehensive unit and integration tests
- Symfony Compatibility: 6.4+ | 7.x | 8.x
- Bundle Focus: Minimal footprint, clean integration
The Symfony bundle provides:
- Service Integration: Seamless DiscogsClient autowiring
- Configuration Management: YAML-based bundle configuration
- Authentication Setup: Personal tokens, consumer credentials, OAuth
- Rate Limiting: Optional throttling for API calls
- Symfony Integration: Compatible with Symfony 6.4+ | 7.x | 8.x
Integration tests ensure:
- Bundle Integration: Bundle correctly configures the Discogs API client
- Symfony Integration: Services are properly wired and injectable
- Configuration: Bundle configuration is correctly applied
- Error Handling: Bundle handles API errors gracefully
- Rate Limiting: Throttling works as configured
- Go to Discogs Developer Settings
- Create a new application
- Note down Consumer Key and Consumer Secret
- Generate a Personal Access Token