Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3']
php: ['7.4', '8.0', '8.1', '8.2', '8.3']

name: PHP ${{ matrix.php }} Tests

Expand All @@ -36,14 +36,14 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Validate composer.json
run: composer validate --strict

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
run: composer install --prefer-dist --no-progress --no-interaction

- name: Run unit tests
run: composer test:unit
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# FamilySearch PHP Lite SDK

[![Packagist](https://img.shields.io/packagist/v/familysearch/fs-php-lite.svg)](https://packagist.org/packages/familysearch/fs-php-lite)
![Tests](https://github.com/PermanentOrg/fs-php-lite/workflows/Tests/badge.svg?branch=master)
[![PHP Version](https://img.shields.io/badge/php-8.1%20%7C%208.2%20%7C%208.3-blue.svg)](https://github.com/PermanentOrg/fs-php-lite)
![Tests](https://github.com/FamilySearch/fs-php-lite/workflows/Tests/badge.svg?branch=master)
[![PHP Version](https://img.shields.io/badge/php-7.4%20%7C%208.0%20%7C%208.1%20%7C%208.2%20%7C%208.3-blue.svg)](https://github.com/FamilySearch/fs-php-lite)

Lite PHP SDK for the [FamilySearch API](https://familysearch.org/developers/).

Expand Down Expand Up @@ -180,7 +180,7 @@ See [TESTING.md](TESTING.md) for detailed testing documentation.

## Requirements

- PHP 8.1 or higher
- PHP 7.4 or higher
- ext-curl
- ext-json

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

Tests run automatically via GitHub Actions on:
- PHP 8.1, 8.2, and 8.3
- PHP 7.4, 8.0, 8.1, 8.2, and 8.3
- Every push and pull request
- Code coverage reports generated for PHP 8.3

Expand Down
81 changes: 75 additions & 6 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The SDK uses a multi-layered testing approach:

## Prerequisites

- PHP 8.1, 8.2, or 8.3
- PHP 7.4, 8.0, 8.1, 8.2, or 8.3
- Composer
- Xdebug (for code coverage)

Expand Down Expand Up @@ -151,7 +151,7 @@ open coverage/index.html
Tests run automatically on every push and pull request via GitHub Actions.

The CI pipeline:
- Tests against PHP 8.1, 8.2, and 8.3
- Tests against PHP 7.4, 8.0, 8.1, 8.2, and 8.3
- Runs both unit and integration tests
- Generates code coverage reports (PHP 8.3 only)
- Uploads coverage to Codecov
Expand Down Expand Up @@ -310,19 +310,88 @@ composer test:integration

## PHP Version Testing

To test against specific PHP versions locally using Docker:
### Test All Supported PHP Versions Locally

To verify compatibility across all supported PHP versions, use Docker with the script below.

#### Quick Test (Single Version)

```bash
# PHP 7.4
docker run --rm -v $(pwd):/app -w /app php:7.4-cli sh -c "apt-get update -qq && apt-get install -y -qq git zip unzip > /dev/null && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer > /dev/null && composer install -q && composer test"

# PHP 8.0
docker run --rm -v $(pwd):/app -w /app php:8.0-cli sh -c "apt-get update -qq && apt-get install -y -qq git zip unzip > /dev/null && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer > /dev/null && composer install -q && composer test"

# PHP 8.1
docker run --rm -v $(pwd):/app -w /app php:8.1-cli composer test
docker run --rm -v $(pwd):/app -w /app php:8.1-cli sh -c "apt-get update -qq && apt-get install -y -qq git zip unzip > /dev/null && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer > /dev/null && composer install -q && composer test"

# PHP 8.2
docker run --rm -v $(pwd):/app -w /app php:8.2-cli composer test
docker run --rm -v $(pwd):/app -w /app php:8.2-cli sh -c "apt-get update -qq && apt-get install -y -qq git zip unzip > /dev/null && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer > /dev/null && composer install -q && composer test"

# PHP 8.3
docker run --rm -v $(pwd):/app -w /app php:8.3-cli composer test
docker run --rm -v $(pwd):/app -w /app php:8.3-cli sh -c "apt-get update -qq && apt-get install -y -qq git zip unzip > /dev/null && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer > /dev/null && composer install -q && composer test"
```

#### Test All Versions at Once

Copy-paste this complete script to test all PHP versions in sequence:

```bash
#!/bin/bash
# Test all supported PHP versions

set -e

VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3")

echo "Testing fs-php-lite across PHP versions..."
echo "============================================"

for VERSION in "${VERSIONS[@]}"; do
echo ""
echo "Testing PHP $VERSION..."
echo "------------------------"

docker run --rm \
-v $(pwd):/app \
-w /app \
php:${VERSION}-cli \
sh -c "
apt-get update -qq && \
apt-get install -y -qq git zip unzip > /dev/null && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer > /dev/null && \
echo 'Installing dependencies...' && \
composer install -q && \
echo 'Running tests...' && \
composer test
"

if [ $? -eq 0 ]; then
echo "✓ PHP $VERSION: PASSED"
else
echo "✗ PHP $VERSION: FAILED"
exit 1
fi
done

echo ""
echo "============================================"
echo "All PHP versions tested successfully!"
```

Save as `test-all-versions.sh`, make executable with `chmod +x test-all-versions.sh`, and run:

```bash
./test-all-versions.sh
```

### Expected Behavior

- **PHP 7.4**: Installs PHPUnit 9.x and php-vcr 1.7.x
- **PHP 8.0**: Installs PHPUnit 9.x or 10.x and php-vcr 1.7.x or 1.8.x
- **PHP 8.1+**: Installs PHPUnit 10.x and php-vcr 1.8.x

## Contributing

When submitting pull requests:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
],
"license": "Apache-2.0",
"require": {
"php": ">=8.1",
"php": ">=7.4",
"ext-curl": "*",
"ext-json": "*"
},
"require-dev": {
"gedcomx/gedcomx-php": "^3.1.2",
"php-vcr/php-vcr": "^1.6",
"phpunit/phpunit": "^10.5",
"php-vcr/php-vcr": "^1.7",
"phpunit/phpunit": "^9.5 || ^10.5",
"php-vcr/phpunit-testlistener-vcr": "^3.0"
},
"autoload": {
Expand Down
Loading