Testing | laravel-analytics-rust | Spatie       

 SPATIE  

laravel-analytics-rust
======================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-analytics-rust](https://spatie.be/docs/laravel-analytics-rust/v1)  Testing

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-analytics-rust/v1) 

  Testing    
- [ Introduction ](https://spatie.be/docs/laravel-analytics-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-analytics-rust/v1/support-us)
- [ Installation ](https://spatie.be/docs/laravel-analytics-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-analytics-rust/v1/usage)
- [ Testing ](https://spatie.be/docs/laravel-analytics-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/laravel-analytics-rust/v1/changelog)

 Testing
=======

###  On this page 

1. [ Local HTTP coverage ](#content-local-http-coverage)
2. [ Credentialed validation ](#content-credentialed-validation)

- Run these checks from the package directory:

```
cargo fmt --all -- --check
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo test --locked --all-targets --all-features
cargo test --locked --doc --all-features
cargo doc --locked --no-deps --all-features
cargo package --locked --allow-dirty --list
```

- CI sets both `RUSTFLAGS` and `RUSTDOCFLAGS` to `-D warnings`. Use the same values locally for warning-free compilation and rustdoc.
- In POSIX shells, prefix commands with `RUSTDOCFLAGS='-D warnings'`. In PowerShell, first run `$env:RUSTDOCFLAGS = '-D warnings'`.
- Clippy includes all default checks and selected pedantic checks for unnecessary clones, closure/method syntax, unused receivers, and ignored consuming builders.
- `cargo package --list` checks the source file selection. CI copies those files to a clean directory and runs integration tests and doctests again, retaining the original Git dependency declarations. A registry archive cannot resolve the unpublished package-tools dependency because Cargo strips Git sources when preparing it. Nothing is published.
- README.md and all Markdown guides participate in rustdoc tests. Hidden `# ` setup lines compile; runnable examples assert their results. Credential-dependent `no_run` examples compile without execution.
- Check the minimum supported Rust version:

```
rustup toolchain install 1.99.0 --profile minimal
cargo +1.99.0 test --locked --all-targets --all-features
cargo +1.99.0 test --locked --doc --all-features
```

- Check security advisories:

```
cargo install cargo-audit --locked
cargo audit
```

- CI runs stable checks on Linux, macOS and Windows, and MSRV and audit checks on Linux. Auditing requires access to the RustSec advisory database.

Local HTTP coverage
-----------------------------------------------------------------------------------------------------------------

- `tests/analytics.rs` uses loopback OAuth and GA4 endpoints. It verifies signed JWT claims, bearer headers, token reuse/renewal, pagination, typed results, malformed responses, API errors, and timeouts.
- Framework tests boot `laravel-rust =0.1.0` and exercise container resolution, memory-cache hits, expiry, and error recovery.
- `tests/core_reports.rs` covers named reports, fluent custom queries, filters and ordering, realtime fields, and property switching. Native `storage::fake`, cache, and clock helpers replace external resources.
- Provider tests cover lazy credential loading, shared client resolution, environment settings, and application overrides. Disabled-cache tests verify that zero lifetime never resolves a store.
- The generated PEM fixtures have never been registered with Google. All tests run without Google credentials or requests to Google.

Credentialed validation
-----------------------------------------------------------------------------------------------------------------------------

- No live GA4 account has been tested. Fixtures establish protocol behavior, not account permissions, quota, or historical data.
- Credentialed validation requires separate authorization and an approved non-production property. Do not point these tests at production.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
