PHP code example of michiruf / laravel-http-automock
1. Go to this page and download the library: Download michiruf/laravel-http-automock library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
michiruf / laravel-http-automock example snippets
it('can do stuff with the api', function () {
Http::automock();
$response = Http::get('https://api.sampleapis.com/coffee/hot')->json();
expect($response)->toHaveCount(20, 'There are not 20 hot coffees in the api service');
});
Http::automock()->skipGet();
Http::automock()->skipPost();
Http::automock()->skipPut();
Http::automock()->skipDelete();
Http::automock()->skipUnlessGet(); // Skip all except GET
Http::automock()->stopSkip(); // Clear all
Http::automock()->stopSkip('alias'); // Clear specific