Testing | laravel-query-builder-rust | Spatie       

 SPATIE  

laravel-query-builder-rust
==========================

spatie.be/open-source

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

 Version   v1      

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

  Testing    
- [ Introduction ](https://spatie.be/docs/laravel-query-builder-rust/v1/introduction)
- [ Requirements ](https://spatie.be/docs/laravel-query-builder-rust/v1/requirements)
- [ About us ](https://spatie.be/docs/laravel-query-builder-rust/v1/about-us)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-query-builder-rust/v1/installation-setup)
- [ Support us ](https://spatie.be/docs/laravel-query-builder-rust/v1/support-us)
- [ Questions and issues ](https://spatie.be/docs/laravel-query-builder-rust/v1/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-query-builder-rust/v1/changelog)
- [ Testing ](https://spatie.be/docs/laravel-query-builder-rust/v1/testing)

Features
--------

- [ Filtering ](https://spatie.be/docs/laravel-query-builder-rust/v1/features/filtering)
- [ Sorting ](https://spatie.be/docs/laravel-query-builder-rust/v1/features/sorting)
- [ Including relationships ](https://spatie.be/docs/laravel-query-builder-rust/v1/features/including-relationships)
- [ Selecting fields ](https://spatie.be/docs/laravel-query-builder-rust/v1/features/selecting-fields)

Advanced usage
--------------

- [ Extending query builder ](https://spatie.be/docs/laravel-query-builder-rust/v1/advanced-usage/extending-query-builder)
- [ Pagination ](https://spatie.be/docs/laravel-query-builder-rust/v1/advanced-usage/pagination)
- [ Multi value delimiter ](https://spatie.be/docs/laravel-query-builder-rust/v1/advanced-usage/multi-value-delimiter)
- [ Front-end implementation ](https://spatie.be/docs/laravel-query-builder-rust/v1/advanced-usage/front-end-implementation)

 Testing
=======

Run from the package directory:

```
./scripts/check
rustup toolchain install 1.99.0 --profile minimal
cargo +1.99.0 test --locked --all-targets
cargo +1.99.0 test --locked --doc
```

- `check` validates guide links, formatting, strict Clippy, integration tests, executable guide examples and API docs. Compiler and rustdoc warnings are errors.
- Clippy checks unnecessary clones and collections, error documentation and Markdown identifiers in addition to its default lints. Public items require documentation and `Debug` implementations.
- `build.rs` discovers every Markdown guide recursively, so new guide examples join the doctest suite automatically. The README is also included in rustdoc.
- `tests/common/mod.rs` boots a Laravel application with `refresh_database`, native model creation through `create!` and migrations from `tests/migrations`.
- Each application uses an isolated in-memory SQLite database. HTTP tests use Laravel's request dispatcher, router and middleware without opening a socket. No database adapter or framework fake is used.

The fixture uses the package's current directory (`for_testing("./")`) as its application base. Keep the trailing forward slash: Laravel 0.1.0 rebases SQLx's generated in-memory filename against this base, and Windows drive prefixes or backslash separators make SQLx 0.9.1 panic while serializing its connection URL. The relative forward-slash base avoids that upstream issue without replacing SQLite, skipping Windows tests or patching the framework.

- Query tests cover URL/body isolation, allowlists, literal wildcard and SQL-shaped input, bound filter values, aliases, custom callbacks and native subject constraints.
- Filter tests compare fixed and dynamic operators on both sides of a boundary, assert typed validation errors and exercise recursive ignored values and grouped conditions.
- Relationship tests load nested and per-parent constrained relations, belongs-to models and aggregates. Retrieval tests cover sparse table results and native pagination.
- Request property tests check URL encoding round trips. Boundary tests assert nesting and array limits, including the largest accepted values.
- Configuration tests register the package-tools provider, check environment-backed settings and application overrides, and reject malformed boolean environment values at startup.
- Other public API tests cover independent query clones, trusted default sorting, field conversion and a caller-defined model with a custom table and named connection.
- CI runs the checks on stable Rust for Linux, macOS and Windows, plus Rust 1.99 on Linux. No crates.io publish step runs.
- For a standalone docs build, select a native database driver explicitly:

```
RUSTDOCFLAGS='-D warnings' cargo doc --locked --no-deps --features laravel/database-sqlite
```

Dependency checks require `cargo-audit` and `cargo-machete`:

```
cargo install cargo-audit cargo-machete --locked
./scripts/check-dependencies
```

The audit reads the committed lockfile and RustSec advisory database. It does not patch or suppress upstream framework advisories.

 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)
