conformance library
Laravel 12 conformance contracts (BLUEPRINT_V2 §11.2): fixtures taken from the Laravel and Sanctum sources plus matchers, shared by the framework's conformance suite and by applications that want to verify their API still speaks Laravel's wire format.
import 'package:daravel_test/conformance.dart';
expect(response.json, isLaravelValidationError({'email': [...]}));
Classes
- LaravelContract
-
Laravel 13 wire and storage contracts that Daravel locks (BLUEPRINT_V2
§11.2). Each value cites the Laravel / Sanctum source it was taken from
(laravel/framework
13.x, laravel/sanctum4.x, laravel/laravel13.x; Laravel 10 to 12 write the same formats, see ADR-025), so a change in either framework is traceable. Changing a value here is a compatibility decision and needs an ADR.
Constants
-
laravelValidationMessages
→ const Map<
String, String> - Laravel 13.x default English validation messages.
Functions
-
isLaravelErrorBody(
String message) → Matcher -
Matches
{"message": message}and nothing else. -
isLaravelLengthAwarePaginator(
) → Matcher -
Matches a
paginate()body: Laravel key order,linksshape with theUrlWindowpage labels, and consistentfrom/to/last_page. -
isLaravelPaginatedResource(
Map< String, Object?> paginatorJson) → Matcher -
Matches a paginated
JsonResource::collectionbody:{data, links: {first, last, prev, next}, meta}withmetaequal to the paginator array minusdataand the URL keys. -
isLaravelValidationError(
[Map< String, List< ? errors]) → MatcherString> > -
Matches a Laravel 422 body: exactly
{message, errors}, the message being the LaravelContract.validationSummary of the errors, and (when given) the exacterrors.