Download the PHP package savvywombat/laravel-test-utils without Composer
On this page you can find all versions of the php package savvywombat/laravel-test-utils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download savvywombat/laravel-test-utils
More information about savvywombat/laravel-test-utils
Files in savvywombat/laravel-test-utils
Package laravel-test-utils
Short Description Utilities and helpers for testing Laravel based applications
License MIT
Homepage https://github.com/SavvyWombat/laravel-test-utils
Informations about the package laravel-test-utils
Laravel test utilities
Utilities and helpers for testing Laravel based applications
Database casting helpers
DBCast::toJson
Use this helper when asserting against the database (such as with assertDatabaseHas or assertDatabaseMissing) to cast an array or json string to a JSON datatype.
DBCast::toTimestamp
User this helper to assert Datetime or Carbon instances against timestamps in the database.
Mock guzzle
This trait assumes that you are using Laravel's IoC to inject the Guzzle client into your code.
Say we're testing a contact form with a Google Recaptcha:
If your controller or other code needs to make more than one request to an API, you can chain responses to the guzzle handler:
Caveats
Currently, the guzzle mock doesn't assert or check anything regarding what requests you are making - it's just a simple way to test your code's reaction to a particular response without having to actually transmit a request to the remote API.
Support
If you are having general issues with this repository, please contact us via the SavvyWombat website.
Please report issues using the GitHub issue tracker. You are also welcome to fork the repository and submit a pull request.
If you're using this repository, we'd love to hear your thoughts. Thanks!
Licence
This package is licensed under The MIT License (MIT).