Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 81 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ or later is required.

## Testing

The SDK includes comprehensive unit and integration tests.
The SDK includes comprehensive unit and integration tests with **79.89% code coverage**.

### Running Tests
### Quick Start

```bash
# Install dependencies
Expand All @@ -160,23 +160,76 @@ composer install
# Run all tests
composer test

# Run only unit tests
# Run only unit tests (fast, ~0.01s)
composer test:unit

# Run only integration tests
# Run only integration tests (with VCR, ~9s)
composer test:integration

# Generate code coverage report
composer test:coverage
```

### Test Suite Statistics

- **60 tests** with 123 assertions
- **79.89% line coverage**, 72.22% method coverage
- **52 unit tests** - Fast, no HTTP requests
- **11 integration tests** - Using recorded API responses (php-vcr)
- **2 skipped tests** - Due to VCR limitations (documented)

### Test Structure

- **Unit Tests** - Fast tests that don't make HTTP requests
- **Integration Tests** - Tests using recorded API responses via php-vcr
- **Examples** - Working demo applications in `/examples` directory
```
tests/
├── Unit/ # 52 tests - SDK logic without HTTP
├── Integration/ # 11 tests - Full SDK with recorded HTTP
├── fixtures/ # VCR cassettes (HTTP recordings)
└── bootstrap.php # Test configuration
```

### Running Tests on Specific PHP Versions

```bash
# Using Docker
docker run --rm -v $(pwd):/app -w /app php:8.0-cli composer test
docker run --rm -v $(pwd):/app -w /app php:8.3-cli composer test

# Using phpenv (if installed)
phpenv local 8.0 && composer test
phpenv local 8.3 && composer test
```

### Viewing Coverage Reports

```bash
# Generate HTML coverage report
composer test:coverage

# Open in browser
open coverage/index.html
```

### Re-recording VCR Cassettes

VCR cassettes record API responses for fast, deterministic integration tests.

```bash
# Set credentials (required for re-recording)
export FAMILYSEARCH_USERNAME="your-sandbox-username"
export FAMILYSEARCH_PASSWORD="your-sandbox-password"
export FAMILYSEARCH_API_KEY="your-api-key"

# Delete old cassettes
rm tests/fixtures/test*.json

# Re-run integration tests (records new cassettes)
composer test:integration
```

See [TESTING.md](TESTING.md) for detailed testing documentation.
**Note:** Cassettes should be re-recorded quarterly or when API changes.

See [TESTING.md](TESTING.md) for detailed testing documentation, and [RERECORD_VCR_GUIDE.md](RERECORD_VCR_GUIDE.md) for complete cassette re-recording instructions.

## Requirements

Expand All @@ -197,8 +250,24 @@ See [TESTING.md](TESTING.md) for detailed testing documentation.
### CI/CD

Tests run automatically via GitHub Actions on:
- PHP 8.0, 8.1, 8.2, and 8.3
- Every push and pull request
- Code coverage reports generated for PHP 8.3
- **PHP 8.0, 8.1, 8.2, and 8.3** (full matrix)
- **Every push** to master/main branches
- **Every pull request**
- **Code coverage** generated for PHP 8.3
- **Coverage reports** uploaded to Codecov

#### CI Status
- ✅ All PHP versions passing (8.0-8.3)
- ✅ 60 tests, 123 assertions
- ✅ 79.89% code coverage
- ✅ No deprecation warnings

See [.github/workflows/tests.yml](.github/workflows/tests.yml) for CI configuration.

### PHP Version Compatibility

**Minimum:** PHP 8.0
**Tested:** PHP 8.0, 8.1, 8.2, 8.3, 8.5
**Recommended:** PHP 8.2+ for security updates

See [.github/workflows/tests.yml](.github/workflows/tests.yml) for CI configuration.
All tests pass on PHP 8.0-8.5 with zero deprecation warnings.
Loading