pschocke/testmacros

Useful Laravel macros that extend tests

dev-master 2019-12-15 21:46 UTC

This package is auto-updated.

Last update: 2024-04-16 07:24:30 UTC


README

This Package is inspired by Spaties Laravel Collections package and extends Laravels default Testing methods with a few useful macros.

Installation

Via Composer

$ composer require pschocke/testmacros --dev

The package will automatically register itself.

Macros

TestResponse

assertResource

Asserts that a response is a resource

$model = factory(App\Model::class)->create();

$this->json('GET', '/route/to/resource')->assertResource(new ModelResource($model));

asArray

Returns the response of a call

$responseArray = $this->json('GET', '/route/to/response')->asArray();

ResourceAsArray

Returns the data attribute of a API resource response

$responseArray = $this->json('GET', '/route/to/resource')->resourceAsArray();

Change log

Please see the changelog for more information on what has changed recently.

Testing

TODO

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email patrick@ausbildung-ms.de instead of using the issue tracker.

License

MIT. Please see the license file for more information.