forked from advoor/nova-editor-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestCase.php
67 lines (58 loc) · 1.64 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
<?php
declare(strict_types=1);
namespace Tests;
use Advoor\NovaEditorJs\FieldServiceProvider;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Tests\Fixtures\TestServiceProvider;
/**
* Defines basic system to test with
*/
class TestCase extends OrchestraTestCase
{
use DatabaseMigrations;
/**
* Ensure the HTTP Client requests have a method to prevent stray requests (without logic)
*
* @before
*/
protected function repairLaravel8Compatibiliy()
{
if (! \Composer\InstalledVersions::satisfies(new \Composer\Semver\VersionParser, 'illuminate/support', '^8.0')) {
return;
}
$this->afterApplicationCreated(function () {
\Illuminate\Http\Client\PendingRequest::macro('preventStrayRequests', function () {
return $this;
});
});
}
/**
* Path to config file from here
*/
private const CONFIG_PATH = __DIR__.'/../src/config/nova-editor-js.php';
/**
* Get package providers.
*
* @param \Illuminate\Foundation\Application $app
* @return array
*/
protected function getPackageProviders($app)
{
return [
FieldServiceProvider::class,
TestServiceProvider::class,
];
}
/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('nova-editor-js', require self::CONFIG_PATH);
$app['config']->set('database.default', 'testing');
}
}