pschocke/testmacros

Useful Laravel macros that extend tests

Downloads

26

Stars

0

Version

Laravel Test-Macros

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 [email protected] instead of using the issue tracker.

License

MIT. Please see the license file for more information.

pschocke

Author

pschocke