forked from ArdentHQ/dashbrd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestCase.php
73 lines (61 loc) · 2.1 KB
/
TestCase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
declare(strict_types=1);
namespace Tests;
use App\Contracts\TextToSpeechProvider;
use App\Jobs\FetchCollectionBanner;
use App\Jobs\FetchCollectionFloorPrice;
use App\Jobs\FetchEnsDetails;
use App\Jobs\FetchNativeBalances;
use App\Jobs\FetchTokens;
use App\Jobs\FetchUserNfts;
use App\Jobs\FetchWalletNfts;
use App\Support\Facades\Alchemy;
use App\Support\Facades\Coingecko;
use App\Support\Facades\Mnemonic;
use App\Support\Facades\Moralis;
use App\Support\Facades\Opensea;
use Database\Seeders\NetworkSeeder;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Notification;
use Tests\Stubs\FakeTextToSpeechProvider;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Setup the test environment.
*/
protected function setUp(): void
{
parent::setUp();
Http::preventStrayRequests();
Coingecko::preventStrayRequests();
Alchemy::preventStrayRequests();
Moralis::preventStrayRequests();
Mnemonic::preventStrayRequests();
Opensea::preventStrayRequests();
// These ensure that tests run fast
Config::set('services.coingecko.retryDelay', 1);
Config::set('services.alchemy.retryDelay', 1);
Config::set('services.moralis.retryDelay', 1);
Config::set('services.mnemonic.retryDelay', 1);
Notification::fake();
// Some API response fixtures rely on the Polygon network being present in the database instead
// of made up ones.
$this->seed(NetworkSeeder::class);
Bus::fake([
FetchTokens::class,
FetchUserNfts::class,
FetchWalletNfts::class,
FetchCollectionBanner::class,
FetchCollectionFloorPrice::class,
FetchNativeBalances::class,
FetchEnsDetails::class,
]);
Cache::flush();
app()->bind(TextToSpeechProvider::class, FakeTextToSpeechProvider::class);
}
}