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
10 changes: 10 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,15 @@ jobs:
- name: "Install dependencies (Composer)"
uses: "ramsey/composer-install@v3"

- name: Setup Mago
if: ${{ matrix.php-version == '8.4' }}
uses: nhedger/setup-mago@v1

- name: Run Mago
if: ${{ matrix.php-version == '8.4' }}
run: |
mago format --dry-run
mago lint --reporting-format=github

- name: "Run PHPUnit"
run: php -dextension=./target/release/libext_biscuit_php.so vendor/bin/phpunit
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,22 @@ $publicKey = PublicKey::fromBytes($bytes, 1); // Explicit Secp256r1
## Testing

```bash
composer install
composer test
cargo build
php \
-dextension=target/debug/libext_biscuit_php.so \
vendor/bin/phpunit
```

## Formatting

# With coverage
composer test:coverage
We're using [Mago](https://mago.carthage.software/) as code-style formatter for PHP code

```bash
composer install
cargo build
php \
-dextension=target/debug/libext_biscuit_php.so \
vendor/bin/mago lint // and format
```

## Generating PHP Stubs
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^10"
"phpunit/phpunit": "^10",
"carthage-software/mago": "^1.0.0-beta.34"
},
"scripts": {
"test": "phpunit",
"test:coverage": "phpunit --coverage-html coverage",
"test:filter": "phpunit --filter"
"config": {
"allow-plugins": {
"carthage-software/mago": true
}
}
}
30 changes: 30 additions & 0 deletions mago.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Welcome to Mago!
# For full documentation, see https://mago.carthage.software/tools/overview
php-version = "8.4.0"

[source]
paths = ["tests/"]
includes = ["vendor"]
excludes = []

[formatter]
print-width = 120
tab-width = 4
use-tabs = false

[linter]
integrations = ["phpunit"]

[linter.rules]
ambiguous-function-call = { enabled = false }
literal-named-argument = { enabled = false }
halstead = { effort-threshold = 7000 }
too-many-methods = { enabled = false }

[analyzer]
find-unused-definitions = true
find-unused-expressions = false
analyze-dead-code = false
check-throws = true
allow-possibly-undefined-array-keys = true
perform-heuristic-checks = true
Loading
Loading