1. Go to this page and download the library: Download lawnstarter/laravel-darksky 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/ */
use Lawnstarter\LaravelDarkSky\DarkSkySampleResponse;
use Lawnstarter\LaravelDarkSky\DarkSky;
class MyTestsDependOnDarksky extends TestCase {
public function test_forecast() {
...
$fakeForecast = DarkSkySampleResponse::forecast();
DarkSky::setTestResponse($fakeForecast);
...
}
public function test_forecast_extended_hourly() {
...
$fakeForecast = DarkSkySampleResponse::forecastExtendedHourly();
DarkSky::setTestResponse($fakeForecast);
...
}
public function test_timemachine() {
...
$fakeForecast = DarkSkySampleResponse::timemachine();
DarkSky::setTestResponse($fakeForecast);
...
}
}